fix(note_type_switcher): don't read blob

This commit is contained in:
Elian Doran 2025-12-24 11:40:01 +02:00
parent faea35b363
commit bd24cf68b6
No known key found for this signature in database
2 changed files with 3 additions and 4 deletions

View File

@ -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<NoteType>([ "text", "code", "book", "canvas" ]);
@ -21,7 +21,7 @@ const supportedNoteTypes = new Set<NoteType>([
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 && (
<>
<div className="intro">{t("note_title.note_type_switcher_label", { type: currentNoteTypeData?.title.toLocaleLowerCase() })}</div>
{pinnedNoteTypes.map(noteType => noteType.type !== currentNoteType && (

View File

@ -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";