-
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
Fix navigation to concierge after leaving the group #42020
Conversation
@ahmedGaber93 Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button] |
Reviewer Checklist
Screenshots/VideosAndroid: Nativea.mp4Android: mWeb Chromeaw.mp4iOS: Nativei.mp4iOS: mWeb Safariiw.mp4MacOS: Chrome / Safariw.mp4MacOS: Desktopd.mp4 |
src/libs/actions/Report.ts
Outdated
@@ -2517,10 +2517,12 @@ function navigateToMostRecentReport(currentReport: OnyxEntry<Report>) { | |||
const isChatThread = ReportUtils.isChatThread(currentReport); | |||
if (lastAccessedReportID) { | |||
const lastAccessedReportRoute = ROUTES.REPORT_WITH_ID.getRoute(lastAccessedReportID ?? ''); | |||
const isFirstRoute = navigationRef?.current?.getState().index === 1; |
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.
const isFirstRoute = navigationRef?.current?.getState().index === 1; | |
const isFirstRoute = navigationRef?.current?.getState()?.index === 1; |
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 think we need to add a comment here to explain why we use === 1
not === 0
src/libs/actions/Report.ts
Outdated
// If it is not a chat thread we should call Navigation.goBack to pop the current route first before navigating to last accessed report. | ||
if (!isChatThread) { | ||
// Fallback to the lastAccessedReportID route, if this is first route in the navigator | ||
Navigation.goBack(lastAccessedReportRoute); | ||
if (!isFirstRoute) { |
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 think we can combine this condition with the above if (!isChatThread && !isFirstRoute)
Bug: Leave room opened from deeplink redirect to concierge.
User is redirect to concierge and if he clicks GoBack, it will redirect to last report, another clicks again on GoBack user go back to home screen. 20240513235055320.mp4 |
@Nodebrute for testing purpose, we need to merge main into this branch as latest main now use different version of node, I do the merge locally to be able to test. Leave groups work fine, but I faced this issue while testing leave room from deeplink. Are you able to reproduce it? |
@ahmedGaber93 This bug isn't specific to Android; it can easily be reproduced on any small screen, such as a small browser window. It existed before these two PRs #39757 #40701. It's because didReportClose returns true in this case. App/src/pages/home/ReportScreen.tsx Line 518 in a6cb60c
|
@Nodebrute well, are we able to fix it? |
@ahmedGaber93 After some further digging, it appears that in this case, the closed report is still being passed to the ReportScreen, which triggers the navigateToConcierge function. Do we need to address this here? I haven't come up with a solution yet. |
I will check it again after one hour as I am in break now. If it has a different root cause and different fix not related to this issue fix, we can ask jules to fix it in a separate issue. |
@Nodebrute I checked it, and I think we need to fix it here as it comes from the same place in I am thinking about using |
@ahmedGaber93 The isFocused solution isn't functioning as expected. Consequently, the room reappears in the LHN. I've logged the In wide screens with no bug In wide screens, when leaving the report, we don't pass the closed report to the ReportScreen. This is not the case on screens where this bug gets reproduced. |
@Nodebrute I agree with you analytics here, but I think this what is In small screen we have transition between screens which end in 300ms, during this time ReportScreen.tsx will handle the So in small screen we can see this issue, and this what I think it happened in small screen:
In wide screen:
The Do you agree with that? Or I missed something. |
@ahmedGaber93 I have made the following changes
You can see that after leaving the room it reappears in LHN Screen.Recording.2024-05-15.at.1.58.38.PM.movAm I adding it incorrectly? |
@Nodebrute, what is the result without isFocused on a small and wide screen? and are you seeing relations between this and LHN can lead to this behavior? |
Without isFocused we have this result on small screen and on Wide screens everything is working fine. |
@Nodebrute well!, what do you think we should do to fix leaving from deeplink issue? |
@ahmedGaber93 I'm working on it. I'll update you in a few minutes. |
@ahmedGaber93 Hey, thanks for your patience. The only solution that's working here is an early return from this useEffect before navigating to the concierge. App/src/pages/home/ReportScreen.tsx Lines 522 to 545 in 76846da
I have added the following code block and it's working fine. I think we can also use !isFocused here too instead of isOptimisticDelete. I haven't tested all cases yet.
|
src/pages/home/ReportScreen.tsx
Outdated
if (!isFocused) { | ||
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.
I think the return early should be in the first line in the block of code, there is no need for any navigation call if navigation is not focused. I think this is more clean. What do you think?
Thanks @Nodebrute 👍, I am reviewing now. Just please update "QA Steps" to include all cases available. |
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!
src/pages/home/ReportScreen.tsx
Outdated
@@ -526,6 +525,10 @@ function ReportScreen({ | |||
isRemovalExpectedForReportType || | |||
isClosedTopLevelPolicyRoom | |||
) { | |||
// If the report isn't focused, navigation to Concierge Chat should be avoided. |
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.
Can you please edit this slightly to explain WHY we shouldn't navigate depending on the focus state
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 need here to prevent ReportScreen.tsx from handling "leaving room optimisticData" during the transition time to prevent undesired redirect to concierge when user leaves a room from the same device.
I think we can say it like this:
// We shouldn't redirect to Concierge Chat when report screen is not focused, like during the transition time,
// As this can cause undesired redirection to Concierge Chat when user leaves a room from the same device.
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.
Changes look good. It would be great to add a few more details to the comments though.
✋ 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/Julesssss in version: 1.4.75-0 🚀
|
🚀 Deployed to production by https://github.com/puneetlath in version: 1.4.75-1 🚀
|
Details
Fixed Issues
$ #41128
PROPOSAL: #41128 (comment)
Tests
Test steps for rooms
Test steps for android/small screen devices
When a user leaves a room/group, Verify that they are navigated to their last opened report
If it's a new user who opens the link from incognito mode and then leaves the room, verify that they are directed to the concierge
Offline tests
Same as above
QA Steps
Test steps for rooms
Test steps for android/small screen devices
When a user leaves a room/group, Verify that they are navigated to their last opened report
If it's a new user who opens the link from incognito mode and then leaves the room, verify that they are directed to the concierge
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
Screen.Recording.2024-05-11.at.11.18.34.PM.mov
Android: mWeb Chrome
Screen.Recording.2024-05-11.at.11.21.15.PM.mov
iOS: Native
Screen.Recording.2024-05-11.at.8.17.10.PM.mov
iOS: mWeb Safari
Screen.Recording.2024-05-11.at.10.41.54.PM.mov
MacOS: Chrome / Safari
Screen.Recording.2024-05-11.at.7.52.10.PM.mov
MacOS: Desktop
Screen.Recording.2024-05-11.at.2.34.50.PM.mov