-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Go back to correct page in referral page #32329
Conversation
src/pages/ReferralDetailsPage.js
Outdated
@@ -108,7 +93,7 @@ function ReferralDetailsPage({route, account}) { | |||
success | |||
style={[styles.w100]} | |||
text={translate('common.buttonConfirm')} | |||
onPress={() => Navigation.goBack(getFallbackRoute())} |
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 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 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
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.
@ArekChr Updated.
src/pages/ReferralDetailsPage.js
Outdated
} | ||
|
||
function getFallbackRoute() { | ||
const fallBackRoute = useMemo(() => { |
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.
We don't need memo optimization here, this is a cheap function
src/pages/ReferralDetailsPage.js
Outdated
@@ -67,6 +63,10 @@ function ReferralDetailsPage({route, account}) { | |||
}; | |||
|
|||
return fallbackRoutes[contentType]; | |||
}, [contentType]); | |||
|
|||
function generateReferralURL(email) { |
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.
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: |
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.
Latest changes LGTM
✋ 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 $250
Offline tests
Same as above
QA Steps
Get $250
PR Author Checklist
### Fixed Issues
section aboveTests
sectionOffline steps
sectionQA steps
sectiontoggleReport
and notonIconClick
)myBool && <MyComponent />
.src/languages/*
files and using the translation methodWaiting for Copy
label for a copy review on the original GH to get the correct copy.STYLE.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 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
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