From 8080d3b8a7a0b51bc552e3c9bef0420f9a98b582 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Tue, 23 Sep 2025 22:20:25 +0300 Subject: [PATCH] fix(client/search): unable to search for empty string --- apps/client/src/widgets/react/hooks.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsx index 6eeac81e1..87779fa36 100644 --- a/apps/client/src/widgets/react/hooks.tsx +++ b/apps/client/src/widgets/react/hooks.tsx @@ -289,7 +289,9 @@ export function useNoteRelation(note: FNote | undefined | null, relationName: Re * * @param note the note whose label to read/write. * @param labelName the name of the label to read/write. - * @returns an array where the first element is the getter and the second element is the setter. The setter has a special behaviour for convenience: if the value is undefined, the label is created without a value (e.g. a tag), if the value is null then the label is removed. + * @returns an array where the first element is the getter and the second element is the setter. The setter has a special behaviour for convenience: + * - if the value is undefined, the label is created without a value (e.g. a tag) + * - if the value is null then the label is removed. */ export function useNoteLabel(note: FNote | undefined | null, labelName: FilterLabelsByType): [string | null | undefined, (newValue: string | null | undefined) => void] { const [ , setLabelValue ] = useState(); @@ -309,9 +311,9 @@ export function useNoteLabel(note: FNote | undefined | null, labelName: FilterLa const setter = useCallback((value: string | null | undefined) => { if (note) { - if (value || value === undefined) { + if (value !== null) { attributes.setLabel(note.noteId, labelName, value) - } else if (value === null) { + } else { attributes.removeOwnedLabelByName(note, labelName); } }