From 965f948899236ac5822d9633081bfa013e614775 Mon Sep 17 00:00:00 2001 From: Lim Chee Aun Date: Thu, 19 Oct 2023 16:06:55 +0800 Subject: [PATCH] Recode some nested modal closing logic Seems more robust --- src/components/account-info.jsx | 44 ++++++++++++++++------------- src/components/account-sheet.jsx | 15 ++-------- src/components/generic-accounts.jsx | 3 ++ src/components/modals.jsx | 7 +++-- src/utils/useLocationChange.js | 23 +++++++++++++++ 5 files changed, 57 insertions(+), 35 deletions(-) create mode 100644 src/utils/useLocationChange.js diff --git a/src/components/account-info.jsx b/src/components/account-info.jsx index 3e8bd86..36c33d1 100644 --- a/src/components/account-info.jsx +++ b/src/components/account-info.jsx @@ -550,11 +550,13 @@ function AccountInfo({ tabIndex={0} to={accountLink} onClick={() => { - states.showAccount = false; - states.showGenericAccounts = { - heading: 'Followers', - fetchAccounts: fetchFollowers, - }; + // states.showAccount = false; + setTimeout(() => { + states.showGenericAccounts = { + heading: 'Followers', + fetchAccounts: fetchFollowers, + }; + }, 0); }} > {!!familiarFollowers.length && ( @@ -581,11 +583,13 @@ function AccountInfo({ tabIndex={0} to={accountLink} onClick={() => { - states.showAccount = false; - states.showGenericAccounts = { - heading: 'Following', - fetchAccounts: fetchFollowing, - }; + // states.showAccount = false; + setTimeout(() => { + states.showGenericAccounts = { + heading: 'Following', + fetchAccounts: fetchFollowing, + }; + }, 0); }} > @@ -597,13 +601,13 @@ function AccountInfo({ { - hideAllModals(); - } - } + // onClick={ + // standalone + // ? undefined + // : () => { + // hideAllModals(); + // } + // } > {shortenNumber(statusesCount)} @@ -626,9 +630,9 @@ function AccountInfo({