From bd24cf68b628610961feefb9d641400cd61d1f90 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Wed, 24 Dec 2025 11:40:01 +0200 Subject: [PATCH] fix(note_type_switcher): don't read blob --- apps/client/src/widgets/layout/NoteTypeSwitcher.tsx | 6 +++--- apps/client/src/widgets/react/hooks.tsx | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/apps/client/src/widgets/layout/NoteTypeSwitcher.tsx b/apps/client/src/widgets/layout/NoteTypeSwitcher.tsx index 60e597bb05..8ac68ae833 100644 --- a/apps/client/src/widgets/layout/NoteTypeSwitcher.tsx +++ b/apps/client/src/widgets/layout/NoteTypeSwitcher.tsx @@ -11,7 +11,7 @@ import { NOTE_TYPES, NoteTypeMapping } from "../../services/note_types"; import server from "../../services/server"; import { Badge, BadgeWithDropdown } from "../react/Badge"; import { FormDropdownDivider, FormListItem } from "../react/FormList"; -import { useNoteBlob, useNoteContext, useNoteProperty, useTriliumEvent } from "../react/hooks"; +import { useNoteContext, useNoteProperty, useNoteSavedData, useTriliumEvent } from "../react/hooks"; import { onWheelHorizontalScroll } from "../widget_utils"; const SWITCHER_PINNED_NOTE_TYPES = new Set([ "text", "code", "book", "canvas" ]); @@ -21,7 +21,7 @@ const supportedNoteTypes = new Set([ export default function NoteTypeSwitcher() { const { note } = useNoteContext(); - const blob = useNoteBlob(note); + const blob = useNoteSavedData(note?.noteId); const currentNoteType = useNoteProperty(note, "type"); const { pinnedNoteTypes, restNoteTypes } = useMemo(() => { const pinnedNoteTypes: NoteTypeMapping[] = []; @@ -44,7 +44,7 @@ export default function NoteTypeSwitcher() { className="note-type-switcher" onWheel={onWheelHorizontalScroll} > - {note && blob?.contentLength === 0 && ( + {note && blob?.length === 0 && ( <>
{t("note_title.note_type_switcher_label", { type: currentNoteTypeData?.title.toLocaleLowerCase() })}
{pinnedNoteTypes.map(noteType => noteType.type !== currentNoteType && ( diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index 19233cded0..39d02911ec 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -27,7 +27,6 @@ import ws from "../../services/ws"; import BasicWidget, { ReactWrappedWidget } from "../basic_widget"; import NoteContextAwareWidget from "../note_context_aware_widget"; import { DragData } from "../note_tree"; -import CKEditor from "./CKEditor"; import { noteSavedDataStore } from "./NoteStore"; import { NoteContextContext, ParentComponent, refToJQuerySelector } from "./react_utils";