@@ -25,7 +25,7 @@ const RootComponent = observer(props => {
25
25
setIsWalletsOnboardingTourGuideVisible,
26
26
notification_messages_ui,
27
27
} = ui ;
28
- const { has_wallet, logout, prevent_redirect_to_hub } = client ;
28
+ const { has_wallet, logout, prevent_redirect_to_hub, is_client_store_initialized } = client ;
29
29
30
30
const { oAuthLogout } = useOauth2 ( { handleLogout : logout } ) ;
31
31
@@ -38,19 +38,19 @@ const RootComponent = observer(props => {
38
38
const STAGING_REDIRECT_URL = 'https://staging-hub.deriv.com/tradershub/home' ;
39
39
40
40
useEffect ( ( ) => {
41
- if ( isHubRedirectionEnabled && has_wallet && ! prevent_redirect_to_hub ) {
41
+ if ( isHubRedirectionEnabled && has_wallet && ! prevent_redirect_to_hub && is_client_store_initialized ) {
42
42
const redirectUrl = process . env . NODE_ENV === 'production' ? PRODUCTION_REDIRECT_URL : STAGING_REDIRECT_URL ;
43
+ // NOTE: Clear OIDC related local storage, this is to prevent OIDC to re-apply client.accounts again from the callback page
44
+ localStorage . removeItem ( 'config.account1' ) ;
45
+ localStorage . removeItem ( 'config.tokens' ) ;
43
46
// NOTE: Clear local storage to prevent user from being logged in at Deriv.app since they should be logged in at low-code Traders Hub only
44
47
localStorage . removeItem ( 'active_loginid' ) ;
45
48
localStorage . removeItem ( 'active_user_id' ) ;
46
49
localStorage . removeItem ( 'client.accounts' ) ;
47
50
localStorage . removeItem ( 'active_wallet_loginid' ) ;
48
- // NOTE: Clear OIDC related local storage, this is to prevent OIDC to re-apply client.accounts again from the callback page
49
- localStorage . removeItem ( 'config.account1' ) ;
50
- localStorage . removeItem ( 'config.tokens' ) ;
51
51
window . location . assign ( redirectUrl ) ;
52
52
}
53
- } , [ isHubRedirectionEnabled , has_wallet , prevent_redirect_to_hub ] ) ;
53
+ } , [ isHubRedirectionEnabled , has_wallet , prevent_redirect_to_hub , is_client_store_initialized ] ) ;
54
54
55
55
return has_wallet ? (
56
56
< Wallets
0 commit comments