Skip to content

Commit 73f31e1

Browse files
fix(overmind-angular): fix typing
1 parent 6952c5d commit 73f31e1

File tree

1 file changed

+10
-6
lines changed
  • packages/node_modules/overmind-angular/src

1 file changed

+10
-6
lines changed

packages/node_modules/overmind-angular/src/index.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,17 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
2626
target.prototype.ngOnInit = function() {
2727
const ngZ = new NgZone({ enableLongStackTrace: false })
2828

29-
this.__tree = overmind.proxyStateTree.getTrackingTree()
29+
this.__tree = (overmind as any).proxyStateTree.getTrackingTree()
30+
this.__currentFlushId = 0
3031
this.overmind = {
3132
state: this.__tree.state,
3233
actions: overmind.actions,
3334
}
3435
this.__shouldUpdatePaths = false
3536
this.__componentInstanceId = componentInstanceId++
36-
this.__onUpdate = () => {
37+
this.__onUpdate = (mutations, paths, flushId) => {
38+
this.__currentFlushId = flushId
39+
3740
if (this.cdr) {
3841
this.cdr.markForCheck()
3942
}
@@ -68,7 +71,7 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
6871
componentId,
6972
componentInstanceId: this.__componentInstanceId,
7073
name: this.constructor.name || '',
71-
paths: Array.from(this.__tree.pathDependencies),
74+
paths: Array.from(this.__tree.pathDependencies) as any,
7275
})
7376

7477
if (targetNgAfterViewInit) {
@@ -92,8 +95,8 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
9295
componentId,
9396
componentInstanceId: this.__componentInstanceId,
9497
name: this.constructor.name || '',
95-
paths: Array.from(this.__tree.pathDependencies),
96-
flushId,
98+
paths: Array.from(this.__tree.pathDependencies) as any,
99+
flushId: this.__currentFlushId,
97100
})
98101
}
99102
if (targetNgAfterViewChecked) {
@@ -112,7 +115,8 @@ export const createConnect = <A extends Overmind<any>>(overmind: A) => () => {
112115
componentInstanceId: this.__componentInstanceId,
113116
name: this.constructor.name || '',
114117
})
115-
overmind.proxyStateTree.disposeTree(this.__tree)
118+
const anyOvermind = overmind as any
119+
anyOvermind.proxyStateTree.disposeTree(this.__tree)
116120
}
117121

118122
return target

0 commit comments

Comments
 (0)