Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(react): fix leak & adjustable class name
Elian Doranc33280bbb2aa
diff --git a/apps/client/src/widgets/react/hooks.tsx b/apps/client/src/widgets/react/hooks.tsxindex a1654eb42d..1a5be3e624 100644--- a/apps/client/src/widgets/react/hooks.tsx+++ b/apps/client/src/widgets/react/hooks.tsx@@ -414,8 +414,9 @@ export function useNoteBlob(note: FNote | null | undefined): [ FBlob | null | unreturn [ blob ] as const;}-export function useLegacyWidget(widgetFactory: () => BasicWidget, { noteContext }: {+export function useLegacyWidget(widgetFactory: () => BasicWidget, { noteContext, containerClassName }: {noteContext?: NoteContext;+ containerClassName?: string;} = {}) {const ref = useRef<HTMLDivElement>(null);const parentComponent = useContext(ParentComponent);@@ -434,7 +435,7 @@ export function useLegacyWidget(widgetFactory: () => BasicWidget, { noteContextconst renderedWidget = widget.render();return [ widget, renderedWidget ];- }, [widgetFactory]);+ }, []);// Attach the widget to the parent.useEffect(() => {@@ -452,5 +453,5 @@ export function useLegacyWidget(widgetFactory: () => BasicWidget, { noteContext}}, [ noteContext ]);- return <div ref={ref} />+ return <div className={containerClassName} ref={ref} />}\ No newline at end of file