File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed
react-simulator-renderer/src
renderer-core/src/renderer Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import cn from 'classnames';
44import { Node } from '@alilc/lowcode-designer' ;
55import LowCodeRenderer from '@alilc/lowcode-react-renderer' ;
66import { observer } from 'mobx-react' ;
7- import { getClosestNode , isFromVC } from '@alilc/lowcode-utils' ;
7+ import { getClosestNode , isFromVC , isReactComponent } from '@alilc/lowcode-utils' ;
88import { GlobalEvent } from '@alilc/lowcode-types' ;
99import { SimulatorRendererContainer , DocumentInstance } from './renderer' ;
1010import { host } from './host' ;
@@ -241,6 +241,11 @@ class Renderer extends Component<{
241241 } ) ;
242242 }
243243
244+ if ( ! isReactComponent ( Component ) ) {
245+ console . error ( `${ viewProps . _componentName } is not a react component!` ) ;
246+ return null ;
247+ }
248+
244249 return createElement (
245250 getDeviceView ( Component , device , designMode ) ,
246251 viewProps ,
Original file line number Diff line number Diff line change @@ -20,10 +20,9 @@ export default function pageRendererFactory(): IBaseRenderComponent {
2020
2121 async componentDidUpdate ( prevProps : IBaseRendererProps , _prevState : { } , snapshot : unknown ) {
2222 const { __ctx } = this . props ;
23- const prevState = this . __parseData ( prevProps . __schema . state , __ctx ) ;
24- const newState = this . __parseData ( this . props . __schema . state , __ctx ) ;
25- // 当编排的时候修改schema.state值,需要将最新schema.state值setState
26- if ( JSON . stringify ( newState ) != JSON . stringify ( prevState ) ) {
23+ // 当编排的时候修改schema.state值,需要将最新 schema.state 值 setState
24+ if ( JSON . stringify ( prevProps . __schema . state ) != JSON . stringify ( this . props . __schema . state ) ) {
25+ const newState = this . __parseData ( this . props . __schema . state , __ctx ) ;
2726 this . setState ( newState ) ;
2827 }
2928
You can’t perform that action at this time.
0 commit comments