mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[FIX] store: properly handle defaultProps in connected components
Thanks to aku for issue + tests + first solution closes #245
This commit is contained in:
@@ -52,15 +52,18 @@ export class ConnectedComponent<T extends Env, P, S> extends Component<T, P, S>
|
||||
}
|
||||
constructor(parent, props?: any) {
|
||||
super(parent, props);
|
||||
|
||||
const store = this.getStore(this.env);
|
||||
const ownProps = Object.assign({}, props || {});
|
||||
const ownProps = this.props || {};
|
||||
const storeProps = (<any>this.constructor).mapStoreToProps(
|
||||
store.state,
|
||||
ownProps,
|
||||
store.getters
|
||||
);
|
||||
const mergedProps = Object.assign({}, props || {}, storeProps);
|
||||
const mergedProps = Object.assign({}, ownProps, storeProps);
|
||||
|
||||
this.props = mergedProps;
|
||||
|
||||
(<any>this.__owl__).ownProps = ownProps;
|
||||
(<any>this.__owl__).currentStoreProps = storeProps;
|
||||
(<any>this.__owl__).store = store;
|
||||
|
||||
Reference in New Issue
Block a user