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; }