mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-02-28 12:50:38 +00:00
fix: 修改 renderer 需等待 document 才开始渲染
This commit is contained in:
parent
62fb4cff3b
commit
e7cc9bc7d8
@ -1309,6 +1309,26 @@ export class BuiltinSimulatorHost implements ISimulatorHost<BuiltinSimulatorProp
|
||||
|
||||
return nearBy;
|
||||
}
|
||||
|
||||
_innerWaitForCurrentDocument(): Promise<any> {
|
||||
const timeGap = 200;
|
||||
return new Promise((resolve) => {
|
||||
setTimeout(() => {
|
||||
if (this.project.currentDocument) {
|
||||
resolve();
|
||||
}
|
||||
}, timeGap);
|
||||
}).catch(() => {
|
||||
return this.waitForCurrentDocument();
|
||||
});
|
||||
}
|
||||
|
||||
waitForCurrentDocument(): Promise<any> {
|
||||
if (this.project.currentDocument) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
return this._innerWaitForCurrentDocument();
|
||||
}
|
||||
// #endregion
|
||||
}
|
||||
|
||||
|
||||
@ -203,13 +203,13 @@ function compatiableReducer(props: any) {
|
||||
};
|
||||
}
|
||||
// 为了能降级到老版本,建议在后期版本去掉以下代码
|
||||
// if (isJSExpression(props) && !props.events) {
|
||||
// return {
|
||||
// type: 'variable',
|
||||
// value: props.mock,
|
||||
// variable: props.value,
|
||||
// }
|
||||
// }
|
||||
if (isJSExpression(props) && !props.events) {
|
||||
return {
|
||||
type: 'variable',
|
||||
value: props.mock,
|
||||
variable: props.value,
|
||||
};
|
||||
}
|
||||
const newProps: any = {};
|
||||
Object.entries<any>(props).forEach(([key, val]) => {
|
||||
newProps[key] = compatiableReducer(val);
|
||||
|
||||
@ -80,7 +80,7 @@ export interface ObjectOf {
|
||||
[k: string]: any;
|
||||
}
|
||||
export interface Shape {
|
||||
type: 'shape';
|
||||
type: "shape";
|
||||
value: {
|
||||
name?: string;
|
||||
propType?: PropType;
|
||||
@ -89,7 +89,7 @@ export interface Shape {
|
||||
[k: string]: any;
|
||||
}
|
||||
export interface Exact {
|
||||
type: 'exact';
|
||||
type: "exact";
|
||||
value: {
|
||||
name?: string;
|
||||
propType?: PropType;
|
||||
|
||||
@ -54,5 +54,5 @@
|
||||
"publishConfig": {
|
||||
"registry": "http://registry.npm.alibaba-inc.com"
|
||||
},
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@1.0.9-2/build/index.html"
|
||||
"homepage": "https://unpkg.alibaba-inc.com/@ali/lowcode-react-renderer@1.0.9-5/build/index.html"
|
||||
}
|
||||
|
||||
@ -177,7 +177,8 @@ export class SimulatorRendererContainer implements BuiltinSimulatorRenderer {
|
||||
}
|
||||
|
||||
constructor() {
|
||||
this.dispose = host.connect(this, () => {
|
||||
this.dispose = host.connect(this, async () => {
|
||||
await host.waitForCurrentDocument();
|
||||
// sync layout config
|
||||
this._layout = host.project.get('config').layout;
|
||||
|
||||
|
||||
@ -1,3 +1,7 @@
|
||||
export function isObject(value: any): value is Record<string, unknown> {
|
||||
return value !== null && typeof value === 'object';
|
||||
}
|
||||
|
||||
export function isI18NObject(value: any): boolean {
|
||||
return isObject(value) && value.type === 'i18n';
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user