fix(client): all tabs loaded in the background

This commit is contained in:
Elian Doran 2026-03-08 12:59:57 +02:00
parent 39bd4ccea1
commit 9a6e20029e
No known key found for this signature in database

View File

@ -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>
);
}