-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Redirect user to concierge when onboarding completed #42087
Conversation
CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅ |
I have read the CLA Document and I hereby sign the CLA |
The modal appears and after loading is complete it disappears. onboardindModalAppearsBriefly.mp4Can we change this to not show the modal at all for already onboarded users? |
@c3024 I will look into this. BTW, this behavior depends on To solve this,
Let me know your thoughts on this. |
I agree. We are showing the modal only after this promise is resolved here as well so it should be fine. App/src/libs/actions/Welcome.ts Line 33 in cba6916
|
@c3024 I set onboarding status completed as initial. |
@@ -45,4 +61,9 @@ function OnboardingModalNavigator() { | |||
|
|||
OnboardingModalNavigator.displayName = 'OnboardingModalNavigator'; | |||
|
|||
export default OnboardingModalNavigator; | |||
export default withOnyx<OnboardingModalNavigatorProps, OnboardingModalNavigatorProps>({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useOnyx
is preferred to withOnyx
HOC. Could you change it?
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return <></>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// eslint-disable-next-line react/jsx-no-useless-fragment | |
return <></>; | |
return null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For me, when I test it on IOS and android, return null
throws some errors. That's why I put Fragment. Need to test again though.
src/types/onyx/index.ts
Outdated
@@ -108,6 +109,7 @@ export type { | |||
MapboxAccessToken, | |||
Modal, | |||
Network, | |||
Onboarding, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is this for? I don't see this export from this file being used anywhere.
const styles = useThemeStyles(); | ||
const {shouldUseNarrowLayout} = useOnboardingLayout(); | ||
|
||
if (hasCompletedGuidedSetupFlow) { | ||
Navigation.goBack(); | ||
Report.navigateToConciergeChat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Report.navigateToConciergeChat(); |
I think just going back without redirecting to Concierge is better. Let me know if there are any edge cases in which redirecting to Concierge is useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suppose you are in a report and clicked https://dev.new.expensify.com:8082/onboarding
link in a message. In this case, if there's only goBack
, it will redirect user to onboarding first and then will go back to the current report. So need to redirect user to Concierge again.
What if there's only one Concierge
redirect? If so, user will be redirect to concierge on deep link click, but if he clicks go back in the browser, it will redirect user to onbarding and then onboarding will redirect user back to concierge, so user can not go back... so these two actions are required and it will remove onboarding from route history...
if (hasCompletedGuidedSetupFlow) { | ||
Navigation.goBack(); | ||
Report.navigateToConciergeChat(); | ||
// eslint-disable-next-line react/jsx-no-useless-fragment | ||
return null; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (hasCompletedGuidedSetupFlow) { | |
Navigation.goBack(); | |
Report.navigateToConciergeChat(); | |
// eslint-disable-next-line react/jsx-no-useless-fragment | |
return null; | |
} | |
useEffect(() => { | |
if (hasCompletedGuidedSetupFlow) { | |
Navigation.goBack(); | |
Report.navigateToConciergeChat(); | |
} | |
}, [hasCompletedGuidedSetupFlow]); | |
if (hasCompletedGuidedSetupFlow) { | |
return null; | |
} |
Is this the error you found in native apps?
ERROR Warning: Cannot update a component (
ForwardRef(BaseNavigationContainer)
) while rendering a different component (OnboardingModalNavigator
). To locate the bad setState() call insideOnboardingModalNavigator
, follow the stack trace as described in https://react.dev/link/setstate-in-render
I think this is due to using navigation while rendering. So we need to move it to a useEffect
.
@c3024 Thanks for your professional review. Just pushed the fixes as you guided. |
Navigation.goBack(); | ||
Report.navigateToConciergeChat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Navigation.goBack(); | |
Report.navigateToConciergeChat(); | |
Navigation.isNavigationReady().then(() => { | |
Navigation.goBack(); | |
Report.navigateToConciergeChat(); | |
} |
navigatorNotReady.mp4
I see the navigator is not ready when navigating to these routes. So, it goes back to onboarding again as seen in the video.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought, this component is defined in Route, so navigation should be ready already...Pushed fix as you mentioned
Reviewer Checklist
Screenshots/VideosAndroid: NativeonboardingRedirectAndroid.mp4Android: mWeb ChromeonboardingRedirectAndroidChrome.mp4iOS: NativeonboardingRedirectiOS.mp4iOS: mWeb SafarionboardingRedirectiOSSafari.mp4MacOS: Chrome / SafarionboardingRedirectChrome-compressed.mp4MacOS: DesktoponboardingRedirectDesktop.mp4 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works for me, but we need to make sure all the other places in the Ap pare updated to work with removing the [] empty array style
src/ONYXKEYS.ts
Outdated
@@ -578,7 +578,7 @@ type OnyxValuesMapping = { | |||
[ONYXKEYS.ACCOUNT]: OnyxTypes.Account; | |||
[ONYXKEYS.ACCOUNT_MANAGER_REPORT_ID]: string; | |||
[ONYXKEYS.NVP_IS_FIRST_TIME_NEW_EXPENSIFY_USER]: boolean; | |||
[ONYXKEYS.NVP_ONBOARDING]: Onboarding | []; | |||
[ONYXKEYS.NVP_ONBOARDING]: Onboarding; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did we change the type? for old accounts the nvp is an empty array so I think we need to keep this
src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx
Outdated
Show resolved
Hide resolved
src/libs/Navigation/AppNavigator/Navigators/OnboardingModalNavigator.tsx
Outdated
Show resolved
Hide resolved
@mountiny Done. |
Please move this if (hasCompletedGuidedSetupFlow) {
return null;
} in Hooks should not be added below Lint is failing. There is a prettier difference as well. Please run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@skyweb331 please address the feedback whenever you can, thanks! |
@c3024 Sorry for wrong merging. I will run |
@@ -40,10 +40,6 @@ function OnboardingModalNavigator() { | |||
}); | |||
}, [hasCompletedGuidedSetupFlow]); | |||
|
|||
if (hasCompletedGuidedSetupFlow) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be removed. Otherwise there is a flash of the onboarding modal like this.
onboardModalFlash.mp4
This should just be moved below the useKeyboardShortcut
hook.
@c3024 Done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
@c3024 can you please approve if all looks good for you. I think the comments were addressed but nowhere to rush |
if (!hasCompletedGuidedSetupFlow) { | ||
return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!hasCompletedGuidedSetupFlow) { | |
return; | |
if (hasCompletedGuidedSetupFlow) { | |
return null; |
Why did you change to negation here for hasCompletedGuidedSetupFlow
?
Why is null
omitted here? Returning undefined
is not allowed for React components. You should explicitly return null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@c3024 Done. Thanks for your great point out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests well. LGTM!
onboardingChrome.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
🚀 Deployed to production by https://github.com/Julesssss in version: 1.4.79-11 🚀
|
@@ -20,6 +24,21 @@ const Stack = createStackNavigator<OnboardingModalNavigatorParamList>(); | |||
function OnboardingModalNavigator() { | |||
const styles = useThemeStyles(); | |||
const {shouldUseNarrowLayout} = useOnboardingLayout(); | |||
const [hasCompletedGuidedSetupFlow] = useOnyx(ONYXKEYS.NVP_ONBOARDING, { | |||
selector: (onboarding) => !Array.isArray(onboarding) && (onboarding?.hasCompletedGuidedSetupFlow ?? true), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line caused this issue: #43561
More detail in this comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean, empty array means onboarding
completed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, thats a mistake. When the hasCompleted property is not defined it means the onboarding was completed given its old user and we do not want to show them the flow in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As far as I remember, nvp_onbarding
was empty array for new users in NewDot, which means, array indicates onboarding is not completed...
Is there any backend changes for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it should not be an empty array for new users. That is the case only for users that had account in OldDot before
Details
Redirect where user was when they try to deeplink to the onboarding flow after completion
Fixed Issues
$ #40876
PROPOSAL: #40876 (comment)
Tests
Offline tests
If user already completed onboarding steps, https://staging.new.expensify.com/onboarding should be redirected to concierge page.
If not, this will not work, because onboarding completion status comes from Backend.
QA Steps
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodSTYLE.md
) were followedAvatar
, I verified the components usingAvatar
are working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG)
)Avatar
is modified, I verified thatAvatar
is working as expected in all cases)Design
label and/or tagged@Expensify/design
so the design team can review the changes.ScrollView
component to make it scrollable when more elements are added to the page.main
branch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTest
steps.Screenshots/Videos
Android: Native
Android: mWeb Chrome
android-mweb.mov
iOS: Native
IOS.mov
iOS: mWeb Safari
ios-mweb.mov
MacOS: Chrome / Safari
mac-chrome.mov
MacOS: Desktop
electron.mov