Open m-natarajan opened 3 weeks ago
Triggered auto assignment to @kevinksullivan (Bug
), see https://stackoverflow.com/c/expensify/questions/14418 for more details. Please add this bug to a GH project, as outlined in the SO.
This has been labelled "Needs Reproduction". Follow the steps here: https://stackoverflowteams.com/c/expensify/questions/16989
@kevinksullivan I reported this issue Plus I can reproduce this issue Can I be a reviewer here please?
Edited by proposal-police: This proposal was edited at 2024-08-19 02:01:08 UTC.
The active background screen when going to contact method from I'm a teacher page changes to profile screen.
When we go to the contact method, getAdaptedStateFromPath is triggered to find the matching root for the contact method RHP. https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts#L192-L193
Based on the CENTRAL_PANE_TO_RHP_MAPPING
file, the matching root for the contact method page is the profile page.
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts#L138-L145
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/CENTRAL_PANE_TO_RHP_MAPPING.ts#L5-L8
So, the profile page central screen is added because there is a state diff. https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkTo/index.ts#L135-L141
But, we actually have a way to find the matching root based on the backTo
params.
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts#L110-L136
When we go from I'm a teacher to a contact method, the backTo
should be the I'm a teacher page, so the matching root would be the I'm a teacher page. But in our case, the backTo
is /
. It's because we define the active route once,
then use it as the backTo
.
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/pages/TeachersUnite/ImTeacherUpdateEmailPage.tsx#L32
Call the get active route when pressing the button in https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/pages/TeachersUnite/ImTeacherUpdateEmailPage.tsx#L32 https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/pages/TeachersUnite/ImTeacherUpdateEmailPage.tsx#L42
Navigation.navigate(ROUTES.SETTINGS_CONTACT_METHODS.getRoute(Navigation.getActiveRouteWithoutParams()))
But this still isn't enough because even though the backTo
is an RHP, isRHPinState
variable here is false.
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts#L114-L115
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/libs/Navigation/linkingConfig/getAdaptedStateFromPath.ts#L123-L129
It's because stateForBackTo.routes
contains [BottomTabNavigator, RHPNavigator], so always accessing the first index won't work. We can just remove isRHPinState
because we already have rhpNavigator
which already finds RHP inside stateForBackTo.routes
.
Last, we need to also pass the backTo
from contact method page to contact method details page and handle the back button press, just like what we did when navigating to new contact method page.
https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/pages/settings/Profile/Contacts/ContactMethodsPage.tsx#L93-L94 https://github.com/Expensify/App/blob/62722e8bc636f1be2e2c9e8e980aac93b76804c9/src/pages/settings/Profile/Contacts/NewContactMethodPage.tsx#L80-L85
@ZhenjaHorbach I don't see step 5. Is there anything missing from the reproduction steps?
@kevinksullivan looking at the code logic, the step 5 will show if we use a public domain email as the default contact method.
Job added to Upwork: https://www.upwork.com/jobs/~010a99315386621f72
Triggered auto assignment to Contributor-plus team member for initial proposal review - @Ollyws (External
)
Is @ZhenjaHorbach reviewing this one?
@Ollyws I would like to review But since we decided to use auto assignment Then go ahead ! All yours 😌
Triggered auto assignment to @cristipaval, see https://stackoverflow.com/c/expensify/questions/7972 for more details.
PR is ready
cc: @Ollyws
Due for payment tomorrow @kevinksullivan, Thanks!
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Version Number: Reproducible in staging?: Needs Reproduction (Reproduction attempt not made as its live) Reproducible in production?: Needs Reproduction If this was caught during regression testing, add the test name, ID and link from TestRail: Email or phone of affected tester (no customers): Logs: https://stackoverflow.com/c/expensify/questions/4856 Expensify/Expensify Issue URL: Issue reported by: @ZhenjaHorbach Slack conversation: https://expensify.slack.com/archives/C049HHMV9SM/p1723753120436449
Action Performed:
Expected Result:
User should remain in the backgrounded
Save the world
pageActual Result:
Active backgrounded page changes to profile page
Workaround:
Unknown
Platforms:
Which of our officially supported platforms is this issue occurring on?
Screenshots/Videos
Add any screenshot/video evidence
View all open jobs on GitHub
Upwork Automation - Do Not Edit
Issue Owner
Current Issue Owner: @Ollyws