From f874823502acc50cee050bb150dec11906644fad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8A=9B=E7=9A=93?= Date: Wed, 2 Jun 2021 14:09:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=9C=A8=E5=8E=8B=E7=BC=A9=E6=80=81?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E7=B1=BB=E5=90=8D,=20=E6=8D=A2=E4=B8=AA?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/designer/src/document/node/props/prop-stash.ts | 2 ++ packages/react-simulator-renderer/src/utils/misc.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/designer/src/document/node/props/prop-stash.ts b/packages/designer/src/document/node/props/prop-stash.ts index 8e92956c7..ca2fc4507 100644 --- a/packages/designer/src/document/node/props/prop-stash.ts +++ b/packages/designer/src/document/node/props/prop-stash.ts @@ -5,6 +5,8 @@ import { Node } from '../node'; export type PendingItem = Prop[]; export class PropStash implements IPropParent { + readonly isPropStash = true; + @obx.val private space: Set = new Set(); @computed private get maps(): Map { diff --git a/packages/react-simulator-renderer/src/utils/misc.ts b/packages/react-simulator-renderer/src/utils/misc.ts index 3ee2af033..10395cf34 100644 --- a/packages/react-simulator-renderer/src/utils/misc.ts +++ b/packages/react-simulator-renderer/src/utils/misc.ts @@ -36,7 +36,7 @@ export function getProjectUtils(librayMap: LibrayMap, utilsMetadata: UtilsMetada */ export function getUppermostPropKey(prop: any): string { let curProp = prop; - while (curProp.parent.constructor.name !== 'Props' && curProp.parent.constructor.name !== 'PropStash') { + while (curProp.parent.isProp) { curProp = curProp.parent; } return curProp.key; @@ -84,7 +84,7 @@ export function setInstancesProp(data: ActivityData, doc: DocumentInstance) { let value = (schema.props as any)[propKey]; // 当 prop 是在 PropStash 中产生时,该 prop 需要在下一个 obx 的时钟周期才能挂载到相应位置, // 而 schema 是同步 export 得到的,此时 schema 中还没有对应的值,所以直接取 newValue - if (prop.parent.constructor.name === 'PropStash') { + if (prop.parent.isPropStash) { value = newValue; }