File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -131,11 +131,18 @@ class SettingsPage extends PureComponent {
131131 componentDidMount ( ) {
132132 this . handleConversionDate ( ) ;
133133
134- if (
135- this . props . shouldShowShieldEntryModal &&
136- ! this . props . hasSubscribedToShield
137- ) {
138- this . setState ( { showShieldEntryModal : true } ) ;
134+ if ( this . props . shouldShowShieldEntryModal ) {
135+ // if user has subscribed to shield, navigate to shield page
136+ // otherwise, show shield entry modal
137+ if ( this . props . hasSubscribedToShield ) {
138+ // componentDidMount is rendered after useEffect() so we need setTimeout to ensure the navigation work
139+ // TODO: use navigate normally when refactor ot use functional component
140+ setTimeout ( ( ) => {
141+ this . props . navigate ( TRANSACTION_SHIELD_ROUTE ) ;
142+ } ) ;
143+ } else {
144+ this . setState ( { showShieldEntryModal : true } ) ;
145+ }
139146 }
140147 }
141148
You can’t perform that action at this time.
0 commit comments