chore(react/launch_bar): port custom widget

This commit is contained in:
Elian Doran
2025-12-04 17:55:38 +02:00
parent b7d7fc8b67
commit 604488b166
3 changed files with 42 additions and 6 deletions

View File

@@ -370,6 +370,16 @@ export function useNoteRelation(note: FNote | undefined | null, relationName: Re
] as const;
}
export function useNoteRelationTarget(note: FNote, relationName: RelationNames) {
const [ targetNote, setTargetNote ] = useState<FNote | null>();
useEffect(() => {
note.getRelationTarget(relationName).then(setTargetNote);
}, [ note ]);
return [ targetNote ] as const;
}
/**
* Allows a React component to read or write a note's label while also reacting to changes in value.
*