@@ -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, is_client_store_initialized } = client ;
28
+ const { has_wallet, logout, prevent_redirect_to_hub, is_client_store_initialized, setPreventSingleLogin } = client ;
29
29
30
30
const { oAuthLogout } = useOauth2 ( { handleLogout : logout } ) ;
31
31
@@ -37,6 +37,10 @@ const RootComponent = observer(props => {
37
37
const PRODUCTION_REDIRECT_URL = 'https://hub.deriv.com/tradershub/home' ;
38
38
const STAGING_REDIRECT_URL = 'https://staging-hub.deriv.com/tradershub/home' ;
39
39
40
+ useEffect ( ( ) => {
41
+ setPreventSingleLogin ( true ) ;
42
+ } , [ ] ) ;
43
+
40
44
useEffect ( ( ) => {
41
45
if ( isHubRedirectionEnabled && has_wallet && ! prevent_redirect_to_hub && is_client_store_initialized ) {
42
46
const redirectUrl = process . env . NODE_ENV === 'production' ? PRODUCTION_REDIRECT_URL : STAGING_REDIRECT_URL ;
@@ -50,6 +54,11 @@ const RootComponent = observer(props => {
50
54
localStorage . removeItem ( 'active_wallet_loginid' ) ;
51
55
window . location . assign ( redirectUrl ) ;
52
56
}
57
+
58
+ const shouldStayInDerivApp = ! isHubRedirectionEnabled || ! has_wallet || prevent_redirect_to_hub ;
59
+ if ( is_client_store_initialized && shouldStayInDerivApp ) {
60
+ setPreventSingleLogin ( false ) ;
61
+ }
53
62
} , [ isHubRedirectionEnabled , has_wallet , prevent_redirect_to_hub , is_client_store_initialized ] ) ;
54
63
55
64
return has_wallet ? (
0 commit comments