Skip to content

Commit 7d650b6

Browse files
authored
🐛 fix: slove the old agents open profiles error problem (#11204)
fix: slove the old agents open profiles error problem
1 parent 5c9b4b3 commit 7d650b6

File tree

1 file changed

+4
-2
lines changed
  • src/app/[variants]/(main)/chat/profile/features/EditorCanvas

1 file changed

+4
-2
lines changed

src/app/[variants]/(main)/chat/profile/features/EditorCanvas/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ const EditorCanvas = memo(() => {
3333
const editorData = config?.editorData;
3434
const systemRole = config?.systemRole;
3535
const updateConfig = useAgentStore((s) => s.updateAgentConfig);
36-
const [initialLoad] = useState(editorData || EMPTY_EDITOR_STATE);
36+
const [initialLoad] = useState(
37+
editorData === undefined || editorData?.root === undefined ? EMPTY_EDITOR_STATE : editorData,
38+
);
3739
const mentionOptions = useMentionOptions();
3840
const editor = useProfileStore((s) => s.editor);
3941
const handleContentChange = useProfileStore((s) => s.handleContentChange);
@@ -89,7 +91,7 @@ const EditorCanvas = memo(() => {
8991
// Don't init if streaming is in progress
9092
if (streamingInProgress) return;
9193
try {
92-
if (editorData) {
94+
if (editorData && editorData?.root !== undefined) {
9395
editor.setDocument('json', editorData);
9496
} else if (systemRole) {
9597
editor.setDocument('markdown', systemRole);

0 commit comments

Comments
 (0)