From 7c86f90ac6aa20627b5e426ad3d7e1fa88704857 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sun, 24 Aug 2025 20:31:39 +0300 Subject: [PATCH] chore(react/ribbon): fix some more crashes when rapidly switching tabs --- apps/client/src/widgets/react/hooks.tsx | 2 +- apps/client/src/widgets/ribbon/EditedNotesTab.tsx | 2 +- apps/client/src/widgets/ribbon/NotePathsTab.tsx | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index ad08893e1..042163531 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -544,7 +544,7 @@ export function useWindowSize() { window.addEventListener("resize", onResize); return () => window.removeEventListener("resize", onResize); - }); + }, []); return size; } diff --git a/apps/client/src/widgets/ribbon/EditedNotesTab.tsx b/apps/client/src/widgets/ribbon/EditedNotesTab.tsx index ce7bcfc19..5bab1c816 100644 --- a/apps/client/src/widgets/ribbon/EditedNotesTab.tsx +++ b/apps/client/src/widgets/ribbon/EditedNotesTab.tsx @@ -27,7 +27,7 @@ export default function EditedNotesTab({ note }: TabContext) { width: "100%", overflow: "auto" }}> - {editedNotes ? ( + {editedNotes?.length ? (
{joinElements(editedNotes.map(editedNote => { return ( diff --git a/apps/client/src/widgets/ribbon/NotePathsTab.tsx b/apps/client/src/widgets/ribbon/NotePathsTab.tsx index 469f32430..dfbe38079 100644 --- a/apps/client/src/widgets/ribbon/NotePathsTab.tsx +++ b/apps/client/src/widgets/ribbon/NotePathsTab.tsx @@ -29,7 +29,7 @@ export default function NotePathsTab({ note, hoistedNoteId, notePath }: TabConte return (
- {sortedNotePaths && ( + {sortedNotePaths?.length && ( <>
{sortedNotePaths.length > 0 ? t("note_paths.intro_placed") : t("note_paths.intro_not_placed")}