Go back to correct page in referral page#32329
Conversation
| success | ||
| style={[styles.w100]} | ||
| text={translate('common.buttonConfirm')} | ||
| onPress={() => Navigation.goBack(getFallbackRoute())} |
There was a problem hiding this comment.
Why removing fallback routes from here? In the proposal, you said that we need to change only onBackButtonPress in HeaderWithBackButton
we should remove onBackButtonPress props and use the default onBackButtonPress as we did on other page
There was a problem hiding this comment.
- Click on FAB > Request Money > switch to Manual
- Enter the amount and click on Next
- Click on 'Request money, get $250' to go to the referral page
- Reload the page
- Click on the 'Got it' Button
Expected Result:
Click on the 'Got it' Button takes you back to the Manual page
Actual Result:
Click on the 'Got it' Button takes you back to the main chat.
issue: #31628
| } | ||
|
|
||
| function getFallbackRoute() { | ||
| const fallBackRoute = useMemo(() => { |
There was a problem hiding this comment.
We don't need memo optimization here, this is a cheap function
| return fallbackRoutes[contentType]; | ||
| }, [contentType]); | ||
|
|
||
| function generateReferralURL(email) { |
There was a problem hiding this comment.
Please bring back original order of functions
|
I'm still unclear. The back button "<" and the "got it" button seem not inconsistent but should be. Removing the fallback route for both buttons will resolve the issue of opening this page from the chat link. However, it will disrupt the usual flow after a page refresh, preventing us from returning to the search | start chat | sending money | etc., from a referral after reloading. I'm still contemplating the best solution, as the current setup needs to fulfil the requirements, we should rethink this flow |
|
@ArekChr What should we do now? |
|
The issue is with how we are setting up the routes. Right now, when we go to 'request money', choose 'manual', and click 'referral', the route changes. It goes from this: https://dev.new.expensify.com:8082/request/new/participants/ to this: https://dev.new.expensify.com:8082/referral/request If we merge all these routes into one, it will make the route history more transparent. This should solve both problems when refreshing the page, going back or pressing got it, and when opening the route from the chat link. https://dev.new.expensify.com:8082/request/new/participants/referral/request @luacmartins, WDYT? I need your 👀 here. |
|
Hmm that makes sense and would indeed make the routes more logical IMO. That being said, we need to account for the other content types - Lines 2829 to 2833 in 2e9cf17 |
|
Thanks, @luacmartins, for the insights. Let's go ahead with the implementation like we talked about. @dukenv0307, do you need additional information or clarification to continue working on this fix? |
|
@ArekChr So what is the expected behavior when we open referral page from the report message link and click on back button or got it button? |
It depends on the link that is clicked. If the link includes only 'referral' as a subpath, it should lead back to the main page. If the 'referral' path includes additional segments like 'request/new/participants', it should navigate back to the specific page as indicated in the path. This navigation should be handled by React Router Dom. |
|
@ArekChr So we only change the route to make it clearer and keep the current logic to get the fallback route, right? because after we change route like this, |
|
@dukenv0307 Correct. Properly implementing routes is crucial for React Router to manage these scenarios effectively @luacmartins, about the referral/request route – since it's just one page and not two, shouldn't we consider simplifying it to something like |
|
I think we can remove this route because after we change the route like the explanation above, no page redirect to this route. |
|
@ArekChr @luacmartins Any thought in this comment above? |
Could you elaborate? Do you mean removing |
|
@ArekChr I mean remove the old route of referral page and use the new route to make it clearer. |
|
@ArekChr got it button is removed and we use navigateBack by default. What should we do now. |
|
@dukenv0307 I think go back button have the same purpose like got it button |
@ArekChr Now when we create request money, the URL will contain |
|
@luacmartins What your thoughts? Do we still need referral request under |
|
Yes, I think we do |
|
@ArekChr In this PR we are trying to go back to the participant page even we reload or not right. If yes, I think this bug is out of the scope of this issue. If not, I think we can close the PR now because we're using |
|
Thanks for volunteering to take over review @situchan |
|
@dukenv0307 please fix conflict. the branch is very behind |
bump ^ |
|
@situchan Merged main and add a new solution. |
|
Please merge main again. Lint is fixed just now in #36423 |
|
@situchan updated. |
Reviewer Checklist
Screenshots/VideosAndroid: Nativeandroid.movAndroid: mWeb Chromemchrome.moviOS: Nativeios.moviOS: mWeb Safarimsafari.movMacOS: Chrome / Safariweb.movMacOS: Desktopdesktop.mov |
|
Please pull main again. 1.4k commits are behind |
|
@situchan Updated. |
|
I checked previous discussions for possible regressions but I think they're fine and agree out of scope. |
|
@dukenv0307 please add context behind this change:
|
|
✋ 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 staging by https://github.com/Beamanator in version: 1.4.43-0 🚀
|
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.43-20 🚀
|


Details
Go back to correct page in referral page
Fixed Issues
$ #31866
PROPOSAL: #31866 (comment)
Tests
Get $250Offline tests
Same as above
QA Steps
Get $250PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand notonIconClick)myBool && <MyComponent />.src/languages/*files and using the translation methodWaiting for Copylabel for a copy review on the original GH to get the correct copy.STYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel so the design team can review the changes.ScrollViewcomponent to make it scrollable when more elements are added to the page.mainbranch was merged into this PR after a review, I tested again and verified the outcome was still expected according to theTeststeps.Screenshots/Videos
Android: Native
Screen.Recording.2023-12-01.at.13.18.11.mov
Android: mWeb Chrome
Screen.Recording.2023-12-01.at.13.09.47.mov
iOS: Native
Screen.Recording.2023-12-01.at.13.13.35.mov
iOS: mWeb Safari
Screen.Recording.2023-12-01.at.13.08.47.mov
MacOS: Chrome / Safari
Screen.Recording.2023-12-01.at.13.06.37.mov
MacOS: Desktop
Screen.Recording.2023-12-01.at.13.19.47.mov