Skip to content

Build your personal knowledge base with Trilium Notes

chore(react/ribbon): fix some more crashes when rapidly switching tabs

Elian Doran7c86f90ac6aa
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx
index ad08893e13..0421635310 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 ce7bcfc197..5bab1c8169 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 ? (
<div className="edited-notes-list use-tn-links">
{joinElements(editedNotes.map(editedNote => {
return (
diff --git a/apps/client/src/widgets/ribbon/NotePathsTab.tsx b/apps/client/src/widgets/ribbon/NotePathsTab.tsx
index 469f324300..dfbe38079f 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 (
<div class="note-paths-widget">
- {sortedNotePaths && (
+ {sortedNotePaths?.length && (
<>
<div className="note-path-intro">
{sortedNotePaths.length > 0 ? t("note_paths.intro_placed") : t("note_paths.intro_not_placed")}