Renderer 更新不检测 scope 变化
This commit is contained in:
parent
6accf51276
commit
b68a644070
|
@ -461,10 +461,14 @@ class SchemaRenderer extends React.Component<SchemaRendererProps, any> {
|
||||||
// 限制:只有 schema 除外的 props 变化,或者 schema 里面的某个成员值发生变化才更新。
|
// 限制:只有 schema 除外的 props 变化,或者 schema 里面的某个成员值发生变化才更新。
|
||||||
shouldComponentUpdate(nextProps: SchemaRendererProps) {
|
shouldComponentUpdate(nextProps: SchemaRendererProps) {
|
||||||
const props = this.props;
|
const props = this.props;
|
||||||
const list: Array<string> = difference(Object.keys(nextProps), ['schema']);
|
const list: Array<string> = difference(Object.keys(nextProps), [
|
||||||
|
'schema',
|
||||||
|
'scope'
|
||||||
|
]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
difference(Object.keys(props), ['schema']).length !== list.length ||
|
difference(Object.keys(props), ['schema', 'scope']).length !==
|
||||||
|
list.length ||
|
||||||
anyChanged(list, this.props, nextProps)
|
anyChanged(list, this.props, nextProps)
|
||||||
) {
|
) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -763,7 +767,11 @@ export function HocStoreFactory(renderer: {
|
||||||
...store.data
|
...store.data
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
} else if (props.scope !== nextProps.scope) {
|
} else if (
|
||||||
|
nextProps.scope &&
|
||||||
|
nextProps.data === nextProps.store!.data &&
|
||||||
|
props.data !== nextProps.data
|
||||||
|
) {
|
||||||
store.initData(
|
store.initData(
|
||||||
createObject(nextProps.scope, {
|
createObject(nextProps.scope, {
|
||||||
// ...nextProps.data,
|
// ...nextProps.data,
|
||||||
|
|
Loading…
Reference in New Issue