mirror of
https://github.com/docmost/docmost
synced 2025-03-28 21:13:28 +00:00
Properly handle null tree node name and icon
This commit is contained in:
parent
b2767d17c2
commit
823eabe1db
@ -67,11 +67,11 @@ export function TitleEditor({
|
||||
if (editor) {
|
||||
// @ts-ignore
|
||||
setTitleEditor(editor);
|
||||
setActivePageId(pageId);
|
||||
}
|
||||
},
|
||||
onUpdate({ editor }) {
|
||||
debounceUpdate();
|
||||
setActivePageId(pageId);
|
||||
},
|
||||
editable: editable,
|
||||
content: title,
|
||||
|
@ -23,14 +23,14 @@ export const useTreeSocket = () => {
|
||||
const initialData = initialTreeData.current;
|
||||
const treeApi = new SimpleTree<SpaceTreeNode>(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 },
|
||||
|
Loading…
x
Reference in New Issue
Block a user