mirror of
https://github.com/zadam/trilium.git
synced 2025-10-21 15:49:00 +02:00
chore(react/collections/table): fix one extra rendering of wrong type
This commit is contained in:
parent
d52cf455a9
commit
68b8ba691f
@ -291,7 +291,7 @@ export function useNoteRelation(note: FNote | undefined | null, relationName: st
|
|||||||
* @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: string): [string | null | undefined, (newValue: string | null | undefined) => void] {
|
export function useNoteLabel(note: FNote | undefined | null, labelName: string): [string | null | undefined, (newValue: string | null | undefined) => void] {
|
||||||
const [ labelValue, setLabelValue ] = useState<string | null | undefined>(note?.getLabelValue(labelName));
|
const [ , setLabelValue ] = useState<string | null | undefined>();
|
||||||
|
|
||||||
useEffect(() => setLabelValue(note?.getLabelValue(labelName) ?? null), [ note ]);
|
useEffect(() => setLabelValue(note?.getLabelValue(labelName) ?? null), [ note ]);
|
||||||
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
useTriliumEvent("entitiesReloaded", ({ loadResults }) => {
|
||||||
@ -319,7 +319,7 @@ export function useNoteLabel(note: FNote | undefined | null, labelName: string):
|
|||||||
useDebugValue(labelName);
|
useDebugValue(labelName);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
labelValue,
|
note?.getLabelValue(labelName),
|
||||||
setter
|
setter
|
||||||
] as const;
|
] as const;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user