diff --git a/src/editor/main.tsx b/src/editor/main.tsx index 497c99f..2681bb5 100644 --- a/src/editor/main.tsx +++ b/src/editor/main.tsx @@ -1,14 +1,15 @@ // F4-L1 设计器独立入口(editor.html 多页应用) // 与主应用 React 实例完全隔离,amis 用 npm 包版,不依赖 sdk-local -import React from 'react'; +// +// ⚠️ 不能包 :amis-editor 用 mobx-state-tree 维护 EditorRoot store, +// StrictMode 在 dev 下故意 mount→unmount→remount,会销毁第一个 EditorRoot,而其 pending +// 异步(markReady / calculateHighlightBox)随后打到已死实例 → 抛 +// 「[mobx-state-tree] object no longer part of a state tree」→ 编辑器整片空白。 +// 主应用 main.tsx 跑 amis SDK(运行时渲染器,容忍 StrictMode),唯独 amis-editor 不行。 import { createRoot } from 'react-dom/client'; import { DesignerPage } from './DesignerPage'; const root = document.getElementById('editor-root'); if (root) { - createRoot(root).render( - - - , - ); + createRoot(root).render(); }