context 更新问题优化

This commit is contained in:
2betop 2024-11-18 17:34:43 +08:00
parent 2cb217aa36
commit eb1a917670

View File

@ -74,10 +74,6 @@ export class RootRenderer extends React.Component<RootRendererProps> {
componentDidUpdate(prevProps: RootRendererProps) {
const props = this.props;
if (props.data !== prevProps.data) {
this.store.initData(props.data);
}
if (props.location !== prevProps.location) {
this.store.updateLocation(props.location, this.props.env?.parseLocation);
}
@ -85,6 +81,10 @@ export class RootRenderer extends React.Component<RootRendererProps> {
if (props.context !== prevProps.context) {
this.store.updateContext(props.context);
}
if (props.data !== prevProps.data) {
this.store.initData(props.data);
}
}
componentDidCatch(error: any, errorInfo: any) {