Missed this

This commit is contained in:
Lim Chee Aun 2023-02-13 10:43:12 +08:00
parent 9a9e16b35a
commit 5f052bb260

View file

@ -146,15 +146,26 @@ function App() {
return () => clearTimeout(timer); return () => clearTimeout(timer);
}; };
useEffect(focusDeck, [location]); 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(() => { useEffect(() => {
if ( if (!showModal) {
!snapStates.showCompose &&
!snapStates.showSettings &&
!snapStates.showAccount
) {
focusDeck(); focusDeck();
} }
}, [snapStates.showCompose, snapStates.showSettings, snapStates.showAccount]); }, [showModal]);
// useEffect(() => { // useEffect(() => {
// // HACK: prevent this from running again due to HMR // // HACK: prevent this from running again due to HMR