From 5f052bb2609acad4adb3cc758afc1623f460355d Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Mon, 13 Feb 2023 10:43:12 +0800 Subject: [PATCH] Missed this --- src/app.jsx | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/src/app.jsx b/src/app.jsx index cb128b02..b2caa839 100644 --- a/src/app.jsx +++ b/src/app.jsx @@ -146,15 +146,26 @@ function App() { return () => clearTimeout(timer); }; useEffect(focusDeck, [location]); + const showModal = useMemo(() => { + return ( + snapStates.showCompose || + snapStates.showSettings || + snapStates.showAccount || + snapStates.showDrafts || + snapStates.showMediaModal + ); + }, [ + snapStates.showCompose, + snapStates.showSettings, + snapStates.showAccount, + snapStates.showDrafts, + snapStates.showMediaModal, + ]); useEffect(() => { - if ( - !snapStates.showCompose && - !snapStates.showSettings && - !snapStates.showAccount - ) { + if (!showModal) { focusDeck(); } - }, [snapStates.showCompose, snapStates.showSettings, snapStates.showAccount]); + }, [showModal]); // useEffect(() => { // // HACK: prevent this from running again due to HMR