Skip to content

Commit

Permalink
fix(overmind-svelte): fix bad merge
Browse files Browse the repository at this point in the history
  • Loading branch information
grandevel committed Sep 9, 2022
1 parent f116189 commit 5b1f6cb
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions packages/overmind-svelte/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
import { ENVIRONMENT, EventType } from 'overmind'
import {
ENVIRONMENT,
EventType,
IReaction,
IConfiguration,
Overmind,
} from 'overmind'
import { afterUpdate, onDestroy, onMount } from 'svelte'
import { ITrackCallback } from 'proxy-state-tree'

const IS_PRODUCTION = ENVIRONMENT === 'production'

let nextComponentId = 0

export function createMixin(overmind) {
export function createMixin<Config extends IConfiguration>(
overmind: Overmind<Config>
) {
const componentId = nextComponentId++
let nextComponentInstanceId = 0
let currentFlushId = 0

const subscribe = (listener) => {
// @ts-ignore
const tree = overmind.proxyStateTreeInstance.getTrackStateTree()
const componentInstanceId = nextComponentInstanceId++
let isUpdating = false
Expand Down Expand Up @@ -57,6 +67,7 @@ export function createMixin(overmind) {
}

return () => {
// @ts-ignore
overmind.proxyStateTreeInstance.disposeTree(tree)
overmind.eventHub.emitAsync(EventType.COMPONENT_REMOVE, {
componentId,
Expand Down

0 comments on commit 5b1f6cb

Please sign in to comment.