mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 19:52:51 +00:00
fix: fix render module state expression initialization exception
This commit is contained in:
parent
f859752118
commit
5bd68ee6b4
@ -4,7 +4,7 @@ import cn from 'classnames';
|
|||||||
import { Node } from '@alilc/lowcode-designer';
|
import { Node } from '@alilc/lowcode-designer';
|
||||||
import LowCodeRenderer from '@alilc/lowcode-react-renderer';
|
import LowCodeRenderer from '@alilc/lowcode-react-renderer';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { getClosestNode, isFromVC } from '@alilc/lowcode-utils';
|
import { getClosestNode, isFromVC, isReactComponent } from '@alilc/lowcode-utils';
|
||||||
import { GlobalEvent } from '@alilc/lowcode-types';
|
import { GlobalEvent } from '@alilc/lowcode-types';
|
||||||
import { SimulatorRendererContainer, DocumentInstance } from './renderer';
|
import { SimulatorRendererContainer, DocumentInstance } from './renderer';
|
||||||
import { host } from './host';
|
import { host } from './host';
|
||||||
@ -241,6 +241,11 @@ class Renderer extends Component<{
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!isReactComponent(Component)) {
|
||||||
|
console.error(`${viewProps._componentName} is not a react component!`);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return createElement(
|
return createElement(
|
||||||
getDeviceView(Component, device, designMode),
|
getDeviceView(Component, device, designMode),
|
||||||
viewProps,
|
viewProps,
|
||||||
|
|||||||
@ -20,10 +20,9 @@ export default function pageRendererFactory(): IBaseRenderComponent {
|
|||||||
|
|
||||||
async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) {
|
async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) {
|
||||||
const { __ctx } = this.props;
|
const { __ctx } = this.props;
|
||||||
const prevState = this.__parseData(prevProps.__schema.state, __ctx);
|
// 当编排的时候修改schema.state值,需要将最新 schema.state 值 setState
|
||||||
const newState = this.__parseData(this.props.__schema.state, __ctx);
|
if (JSON.stringify(prevProps.__schema.state) != JSON.stringify(this.props.__schema.state)) {
|
||||||
// 当编排的时候修改schema.state值,需要将最新schema.state值setState
|
const newState = this.__parseData(this.props.__schema.state, __ctx);
|
||||||
if (JSON.stringify(newState) != JSON.stringify(prevState)) {
|
|
||||||
this.setState(newState);
|
this.setState(newState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user