[FIX] connected_component: some misc issues

- did not properly stop listening to the store after being destroyed
- did not properly synchronize store updates in some async cases
This commit is contained in:
Géry Debongnie
2019-08-27 16:50:50 +02:00
parent 3b1247d476
commit a3d563ebb4
2 changed files with 111 additions and 2 deletions
+5 -1
View File
@@ -77,6 +77,10 @@ export class ConnectedComponent<T extends Env, P, S> extends Component<T, P, S>
(this.__owl__ as any).store.off("update", this);
super.__callWillUnmount();
}
__destroy(parent: any) {
(this.__owl__ as any).store.off("update", this);
super.__destroy(parent);
}
async __updateProps(nextProps: P, f, p, s, v) {
this.__updateStoreProps(nextProps);
@@ -110,7 +114,7 @@ export class ConnectedComponent<T extends Env, P, S> extends Component<T, P, S>
}
const didChange = this.__updateStoreProps(this.props);
if (didChange) {
this.render();
return this.render();
}
}
}