mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2025-12-12 11:20:11 +00:00
fix: fix render module state expression initialization exception
This commit is contained in:
parent
9a5a04ac95
commit
9c545cca60
@ -4,7 +4,7 @@ import cn from 'classnames';
|
||||
import { Node } from '@alilc/lowcode-designer';
|
||||
import LowCodeRenderer from '@alilc/lowcode-react-renderer';
|
||||
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 { SimulatorRendererContainer, DocumentInstance } from './renderer';
|
||||
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(
|
||||
getDeviceView(Component, device, designMode),
|
||||
viewProps,
|
||||
|
||||
@ -20,10 +20,9 @@ export default function pageRendererFactory(): IBaseRenderComponent {
|
||||
|
||||
async componentDidUpdate(prevProps: IBaseRendererProps, _prevState: {}, snapshot: unknown) {
|
||||
const { __ctx } = this.props;
|
||||
const prevState = this.__parseData(prevProps.__schema.state, __ctx);
|
||||
const newState = this.__parseData(this.props.__schema.state, __ctx);
|
||||
// 当编排的时候修改schema.state值,需要将最新schema.state值setState
|
||||
if (JSON.stringify(newState) != JSON.stringify(prevState)) {
|
||||
// 当编排的时候修改schema.state值,需要将最新 schema.state 值 setState
|
||||
if (JSON.stringify(prevProps.__schema.state) != JSON.stringify(this.props.__schema.state)) {
|
||||
const newState = this.__parseData(this.props.__schema.state, __ctx);
|
||||
this.setState(newState);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user