diff --git a/packages/designer/src/document/node/node.ts b/packages/designer/src/document/node/node.ts index 3b7c507e0..cc336e044 100644 --- a/packages/designer/src/document/node/node.ts +++ b/packages/designer/src/document/node/node.ts @@ -813,9 +813,9 @@ export class Node { * @deprecated */ registerAddon(key: string, exportData: () => any, isProp: boolean = false) { - if (this._addons[key]) { - throw new Error(`node addon ${key} exist`); - } + // if (this._addons[key]) { + // throw new Error(`node addon ${key} exist`); + // } this._addons[key] = { exportData, isProp }; } diff --git a/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts b/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts index aebbcbcbd..42ed2ad27 100644 --- a/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts +++ b/packages/editor-preset-vision/src/bundle/upgrade-metadata.ts @@ -281,21 +281,24 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec } let initialFn = (slotName ? null : initial) || initialValue; - if (slotName && initialValue === true) { - initialFn = (value: any, defaultValue: any) => { - if (isJSSlot(value)) { - return { - title: slotTitle || title, - ...value, - }; - } - return { - type: 'JSSlot', - title: slotTitle || title, - value: initialChildren, - }; - }; - } + // 在 upgrade reducer 做了 JSBlock ——> JSSlot + // if (slotName && initialValue === true) { + // initialFn = (value: any, defaultValue: any) => { + // if (isJSSlot(value)) { + // return { + // title: slotTitle || title, + // name: slotName, + // ...value, + // }; + // } + // return { + // type: 'JSSlot', + // title: slotTitle || title, + // name: slotName, + // value: initialChildren, + // }; + // }; + // } if (!slotName) { if (accessor) { @@ -401,6 +404,7 @@ export function upgradePropConfig(config: OldPropConfig, collector: ConfigCollec return { type: 'JSSlot', title: slotTitle || title, + name: slotName, value: value == null ? initialChildren : value, }; }, diff --git a/packages/react-renderer/src/engine/base.jsx b/packages/react-renderer/src/engine/base.jsx index b2456deb4..775e77a9b 100644 --- a/packages/react-renderer/src/engine/base.jsx +++ b/packages/react-renderer/src/engine/base.jsx @@ -309,6 +309,8 @@ export default class BaseEngine extends PureComponent { if (scopeKey && this.__compScopes[scopeKey]) { props.__scope = this.__compScopes[scopeKey]; } + // FIXME 这里清除 key 是为了避免循环渲染中更改 key 导致的渲染重复 + props.key = ''; if (schema.__ctx && schema.__ctx.lunaKey) { if (!isFileSchema(schema)) { engine && engine.props.onCompGetCtx(schema, self); @@ -317,6 +319,7 @@ export default class BaseEngine extends PureComponent { } else if (typeof idx === 'number' && !props.key) { props.key = idx; } + props.__id = schema.id; const renderComp = (props) => { return engine.createElement(