diff --git a/apps/client/src/features/editor/title-editor.tsx b/apps/client/src/features/editor/title-editor.tsx index d2cc4783..9cb17aa0 100644 --- a/apps/client/src/features/editor/title-editor.tsx +++ b/apps/client/src/features/editor/title-editor.tsx @@ -67,11 +67,11 @@ export function TitleEditor({ if (editor) { // @ts-ignore setTitleEditor(editor); + setActivePageId(pageId); } }, onUpdate({ editor }) { debounceUpdate(); - setActivePageId(pageId); }, editable: editable, content: title, diff --git a/apps/client/src/features/websocket/use-tree-socket.ts b/apps/client/src/features/websocket/use-tree-socket.ts index b203ee1c..df160ec8 100644 --- a/apps/client/src/features/websocket/use-tree-socket.ts +++ b/apps/client/src/features/websocket/use-tree-socket.ts @@ -23,14 +23,14 @@ export const useTreeSocket = () => { const initialData = initialTreeData.current; const treeApi = new SimpleTree(initialData); - if (treeApi.find(event.id)) { - if (event.payload?.title) { + if (treeApi.find(event?.id)) { + if (event.payload?.title !== undefined) { treeApi.update({ id: event.id, changes: { name: event.payload.title }, }); + setTreeData(treeApi.data); } - setTreeData(treeApi.data); } }; @@ -49,13 +49,13 @@ export const useTreeSocket = () => { case "updateOne": if (event.entity[0] === "pages") { if (treeApi.find(event.id)) { - if (event.payload?.title) { + if (event.payload?.title !== undefined) { treeApi.update({ id: event.id, changes: { name: event.payload.title }, }); } - if (event.payload?.icon) { + if (event.payload?.icon !== undefined) { treeApi.update({ id: event.id, changes: { icon: event.payload.icon },