From 13b04ad816632bb62b7be60fa0befdf3629dc604 Mon Sep 17 00:00:00 2001 From: lelenei <72531217+lelenei@users.noreply.github.com> Date: Sat, 9 Oct 2021 15:18:00 +0800 Subject: [PATCH] fix: failed to switch to the NFTs tab if the currently selected tab is loading --- .../twitter.com/injection/EnhancedProfileTab.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/maskbook/src/social-network-adaptor/twitter.com/injection/EnhancedProfileTab.tsx b/packages/maskbook/src/social-network-adaptor/twitter.com/injection/EnhancedProfileTab.tsx index 047fcc3e3c12..c1ed4b9f9c32 100644 --- a/packages/maskbook/src/social-network-adaptor/twitter.com/injection/EnhancedProfileTab.tsx +++ b/packages/maskbook/src/social-network-adaptor/twitter.com/injection/EnhancedProfileTab.tsx @@ -1,6 +1,6 @@ import { MutationObserverWatcher } from '@dimensiondev/holoflows-kit' import { EnhancedProfileTab } from '../../../components/InjectedComponents/EnhancedProfileTab' -import { createReactRootShadowed, startWatch } from '../../../utils' +import { createReactRootShadowed, startWatch, untilElementAvailable } from '../../../utils' import { searchForegroundColorSelector, searchNewTweetButtonSelector, @@ -71,7 +71,7 @@ const useStyles = makeStyles()((theme, props) => ({ const EMPTY_STYLE = {} as CSSStyleDeclaration -function clear() { +async function clear() { const eleTab = searchProfileTabSelector().evaluate()?.querySelector('div') as Element if (!eleTab) return const style = window.getComputedStyle(eleTab) @@ -87,6 +87,7 @@ function clear() { if (eleEmpty) eleEmpty.style.display = 'none' // set display: none will change the height of the original element + await untilElementAvailable(searchProfileTabPageSelector()) const elePage = searchProfileTabPageSelector().evaluate() if (elePage) elePage.style.visibility = 'hidden' }