-
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
[$250] Hybrid - Android - WS Switcher - App is closed when switching workspace and using device back button. #53533
Comments
Triggered auto assignment to @RachCHopkins ( |
Can Repro - When I hit the device back button it closes the app entirely. I am on 9.0.71-1 |
Job added to Upwork: https://www.upwork.com/jobs/~021864885051135538956 |
Triggered auto assignment to Contributor-plus team member for initial proposal review - @eh2077 ( |
ProposalPlease re-state the problem that we are trying to solve in this issueWhen the user switches to a specific workspace chats and then uses device back button, the app is closed instead of displaying all chats again (Expensify). What is the root cause of that problem?Note The issue is present on Android: Native as well as on Android: HybridApp (more details below). In the App/src/libs/Navigation/switchPolicyID.ts Lines 150 to 156 in b595f5d
as this block comes into action on narrow layout devices because of this condition: App/src/libs/Navigation/switchPolicyID.ts Lines 115 to 116 in b595f5d
Because that block pops all central pane routes out in order for the bottom tab navigator to be visible, this means that the only route present in the stack is What's the code responsible for handling the hardware / device back button and close the app on Android ? We have this android platform specific function
For Android: Native though we don't have any code in this function to specifically handle behaviour, therefore it defaults to the standard behaviour (close the app) at the end of the function:
What changes do you think we should make in order to solve the problem?To solve our issue on both Android: Native and HybridApp we have to implement the following changes:
add the following logic: const isWorkspaceHomeOnlyRoute = bottomTabRoutes.every((route) => route.name === SCREENS.HOME && !!(route.params as {policyID?: string})?.policyID);
if (isLastScreenOnStack && isWorkspaceHomeOnlyRoute) {
navigationRef.dispatch({...StackActions.replace(SCREENS.HOME)});
return true;
} Explanation
This will fix the issue as required by the Expected result (see video below) because when we will perform the go back action we will have the Home screen in the stack and will be navigated to Home (all chats), then if we go back again from Home then the app will close as expected. Additional explanation regarding Android: HybridApp -> under the new logic added above we will keep the Android: HybridApp logic unchanged since in case the newly added condition doesn't pass it means we want to keep the existing cc @adamgrzybowski @Kicu for a take on the proposed solution as they worked on Result video (before / after)Android: Native
|
ProposalPlease re-state the problem that we are trying to solve in this issue.Android - WS Switcher - App is closed when switching workspace and using device back button. What is the root cause of that problem?
What changes do you think we should make in order to solve the problem?
Results### Demo Videos
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?Because this issue come from this, we need to check other related cases. What alternative solutions did you explore? (Optional)N/A |
ProposalPlease re-state the problem that we are trying to solve in this issue.App closes when switching workspaces and pressing the back button, instead of showing Inbox. What is the root cause of that problem?Navigation stack isn't updated correctly, causing the app to exit on back press. What changes do you think we should make in order to solve the problem?The first block updates the stack to push
What specific scenarios should we cover in automated tests to prevent reintroducing this issue in the future?
What alternative solutions did you explore? (Optional)
|
@RachCHopkins, @eh2077 Whoops! This issue is 2 days overdue. Let's get this updated quick! |
Reviewing proposals |
I am unsure why we decided to use But if we assume that switching policy with One thing worth mentioning is that if we go However, I'm not sure this is that important, considering that with the changes to Alternatively, the second proposal by @linhvovan29546 suggests going back to the old method with cc: @mountiny you seem to have some context about native stacks @WojtekBoman as policy police |
I think that @chrispader @kirillzyusko added this to fix a bug they encountered, but I agree that if this ruins the history its not the best solution and we might want to rethink it. But we need to make sure there is no regression after switching back to that. |
I think that's the way as it was done on purpose in this PR: This is the reason why I mentioned using But if we do, my proposal can be flexible and details like replacing the navigation method with I don't consider other proposals mentioning
Another reason would be that the Expected result clearly states:
and there were no details mentioning the expected behaviour when switching between multiple workspaces then attempting the hardware go back button. |
I can throw my 2 cents here, I was responsible for making sure When I was working on search I made the policyID work correctly with the data from URL, so that these steps work:
So as you can see at least in ☝️ flow, policyID behaves more like stacked history. I don't have strong opinions which is better, but if we move into the direction of |
I agree with @Kicu I think that the policyId should be kept in history so you can go back to the previously chosen policy This was just an oversight on our part as its quite niche flow @chrispader @kirillzyusko Could you please weigh in when you get a moment? |
@mountiny I think the code changes to fix this issue. For the blank screen issue, it seems to be related to |
@mountiny I think the problem comes from the changes made by @chrispader? If so I would wait when @chrispader returns from its vacation and can shed more light on the issue (because I'm not aware what @chrispader was attempting to solve) For me it looks like there was a Home screen that was re-mounting somehow and @chrispader fixed it via After reading this conversation I think that the fix that @chrispader made could produce #53359 as well (or at the problem is very highly related to each other). Also what @Kicu explains makes sense to me. So maybe we just need to go back with
Makes more sense for me/sounds like a better approach 👍 |
Yes, so the problem i was trying to solve was that we would see a blank HomeScreen for a brief moment the when we would change the workspace, because the screen is re-mounted and therefore re-renders. Under the previous stack navigation, this was not causing issues, but with I was not aware, that we want to be able to keep a "workspace history" that we can go back to. So the fix with This is the original i and @kirillzyusko are referring to, reported by @ishpaul777: #49937 (comment) Migrate.E.App.PlatformStackNavigation.mov |
Putting ScreenRecording_12-11-2024.15-16-44_1.MP4 |
A fix that removes the blank screen but basically just delays the route push and the content re-rendering is putting the ScreenRecording_12-11-2024.15-24-18_1.MP4wdyt? @mountiny @kirillzyusko |
@kirillzyusko i can confirm that the changes discussed are also causing #53359. This change also fixes the issue on the search page: ScreenRecording_12-11-2024.16.MP4 |
Not overdue, valuable discussions continue! |
@chrispader Cool! The Edited: We can revisit this issue after reworking the original PR. @mountiny All yours! 🎀👀🎀 C+ reviewed |
Triggered auto assignment to @Beamanator, see https://stackoverflow.com/c/expensify/questions/7972 for more details. |
Sounds good, lets make sure this is working fine on web too |
If you haven’t already, check out our contributing guidelines for onboarding and email [email protected] to request to join our Slack channel!
Version Number: 9.0.71-0
Reproducible in staging?: Yes
Reproducible in production?: No
If this was caught on HybridApp, is this reproducible on New Expensify Standalone?: No, reproducible on hybrid only
If this was caught during regression testing, add the test name, ID and link from TestRail: N/A
Email or phone of affected tester (no customers): [email protected]
Issue reported by: Applause Internal Team
Action Performed:
Expected Result:
After switching workspaces and using device back button, all the chats should be displayed again on inbox.
Actual Result:
The app is closed instead of displaying all chats again, when the user switch workspaces and uses device back button. When the app is reopened, all chats are displayed in inbox.
Workaround:
Unknown
Platforms:
Screenshots/Videos
Bug6683901_1733291014764.WS_Switch.mp4
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @eh2077The text was updated successfully, but these errors were encountered: