File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
apps/client/src/widgets/react Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -406,14 +406,17 @@ export function useNoteLabelWithDefault(note: FNote | undefined | null, labelNam
406406}
407407
408408export function useNoteLabelBoolean ( note : FNote | undefined | null , labelName : FilterLabelsByType < boolean > ) : [ boolean , ( newValue : boolean ) => void ] {
409- const [ labelValue , setLabelValue ] = useState < boolean > ( ! ! note ?. hasLabel ( labelName ) ) ;
409+ const [ , forceRender ] = useState ( { } ) ;
410410
411- useEffect ( ( ) => setLabelValue ( ! ! note ?. hasLabel ( labelName ) ) , [ note ] ) ;
411+ useEffect ( ( ) => {
412+ forceRender ( { } ) ;
413+ } , [ note ] ) ;
412414
413415 useTriliumEvent ( "entitiesReloaded" , ( { loadResults } ) => {
414416 for ( const attr of loadResults . getAttributeRows ( ) ) {
415417 if ( attr . type === "label" && attr . name === labelName && attributes . isAffecting ( attr , note ) ) {
416- setLabelValue ( ! attr . isDeleted ) ;
418+ forceRender ( { } ) ;
419+ break ;
417420 }
418421 }
419422 } ) ;
@@ -430,6 +433,7 @@ export function useNoteLabelBoolean(note: FNote | undefined | null, labelName: F
430433
431434 useDebugValue ( labelName ) ;
432435
436+ const labelValue = ! ! note ?. hasLabel ( labelName ) ;
433437 return [ labelValue , setter ] as const ;
434438}
435439
You can’t perform that action at this time.
0 commit comments