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
fix(client): all tabs loaded in the background
Elian Doran9a6e20029e7e
diff --git a/apps/client/src/widgets/NoteDetail.tsx b/apps/client/src/widgets/NoteDetail.tsxindex 206b2a325a..785546f0be 100644--- a/apps/client/src/widgets/NoteDetail.tsx+++ b/apps/client/src/widgets/NoteDetail.tsx@@ -243,10 +243,12 @@ function FixedTree({ noteContext }: { noteContext: NoteContext }) {*/function NoteDetailWrapper({ Element, type, isVisible, isFullHeight, props }: { Element: (props: TypeWidgetProps) => VNode, type: ExtendedNoteType, isVisible: boolean, isFullHeight: boolean, props: TypeWidgetProps }) {const [ cachedProps, setCachedProps ] = useState(props);+ const [ hasBeenVisible, setHasBeenVisible ] = useState(isVisible);useEffect(() => {if (isVisible) {setCachedProps(props);+ setHasBeenVisible(true);} else {// Do nothing, keep the old props.}@@ -260,7 +262,7 @@ function NoteDetailWrapper({ Element, type, isVisible, isFullHeight, props }: {height: isFullHeight ? "100%" : ""}}>- { <Element {...cachedProps} /> }+ { hasBeenVisible && <Element {...cachedProps} /> }</div>);}