🐛 fix: slove the old agents open profiles error problem (#11204)

fix: slove the old agents open profiles error problem
This commit is contained in:
Shinji-Li
2026-01-04 18:09:15 +08:00
committed by GitHub
parent 5c9b4b3c40
commit 7d650b6d2e

View File

@@ -33,7 +33,9 @@ const EditorCanvas = memo(() => {
const editorData = config?.editorData;
const systemRole = config?.systemRole;
const updateConfig = useAgentStore((s) => s.updateAgentConfig);
const [initialLoad] = useState(editorData || EMPTY_EDITOR_STATE);
const [initialLoad] = useState(
editorData === undefined || editorData?.root === undefined ? EMPTY_EDITOR_STATE : editorData,
);
const mentionOptions = useMentionOptions();
const editor = useProfileStore((s) => s.editor);
const handleContentChange = useProfileStore((s) => s.handleContentChange);
@@ -89,7 +91,7 @@ const EditorCanvas = memo(() => {
// Don't init if streaming is in progress
if (streamingInProgress) return;
try {
if (editorData) {
if (editorData && editorData?.root !== undefined) {
editor.setDocument('json', editorData);
} else if (systemRole) {
editor.setDocument('markdown', systemRole);