mirror of
https://gitee.com/baidu/amis.git
synced 2024-12-01 19:38:16 +08:00
fix: 修复只更新 context rootStore 无法监听变化的问题 (#11261)
This commit is contained in:
parent
f3a9951fe6
commit
0a1ba7446f
@ -101,12 +101,15 @@ export class RootRenderer extends React.Component<RootRendererProps> {
|
||||
this.store.updateLocation(props.location, this.props.env?.parseLocation);
|
||||
}
|
||||
|
||||
let contextChanged = false;
|
||||
if (props.context !== prevProps.context) {
|
||||
contextChanged = true;
|
||||
this.store.updateContext(props.context);
|
||||
}
|
||||
|
||||
// 一定要最后处理,否则 downStream 里面的上层数据 context 还是老的。
|
||||
if (props.data !== prevProps.data) {
|
||||
if (props.data !== prevProps.data || contextChanged) {
|
||||
// context 依赖 data 变化才能触发变动,所以不管 data 变没变都更新一下
|
||||
this.store.initData(props.data);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user