[NoQA] Add eslint rule to prevent adding new backTo params to screen type definitions#70647
Conversation
95b8d1b to
c286d73
Compare
f2aa050 to
f0d0a02
Compare
f0d0a02 to
2f3cd5c
Compare
| - [Finding the code that calls the navigation function](#finding-the-code-that-calls-the-navigation-function) | ||
| - [Using `backTo` route param](#using-backto-route-param) | ||
| - [How to remove backTo from URL](#how-to-remove-backto-from-url) | ||
| - [Separate routes for each screen instance](#separate-routes-for-each-screen-instance) |
There was a problem hiding this comment.
| - [Separate routes for each screen instance](#separate-routes-for-each-screen-instance) | |
| - [Separating routes for each screen instance](#separate-routes-for-each-screen-instance) |
For consistency, most other bullets are in this form
| const customAction = () => { | ||
| if(route.name === SCREENS.SEARCH.REPORT_RHP) { | ||
| // do something when screen is SCREENS.SEARCH.REPORT_RHP | ||
| }else { |
There was a problem hiding this comment.
| }else { | |
| } else { |
|
|
||
| 3. Custom component behavior depending on the current route | ||
|
|
||
| If we want the component's behavior to change based on the current route, we can implement this using the `route` property. We can use it to specify the correct return route after a refresh. |
There was a problem hiding this comment.
Didn't see this in the codebase before. In my implementations I was going more towards creating a common components with minimal number of props and reusing it across multiple files as it seemed cleaner and the actual page can be collocated in the codebase with the feature we're using.
Example src/pages/settings/VerifyAccountPageBase.tsx
| - LastNamePage: `/example-form/:firstName/:lastName` | ||
| - DateOfBirthPage: `/example-form/:firstName:/:lastName/:dateOfBirth` | ||
|
|
||
| Thanks to this structure, we are able to easily recreate the order of screens with the appropriate values in the form. |
There was a problem hiding this comment.
Would add sth about this approach NOT being recommended for complex form with large number of inputs
Codecov Report✅ All modified and coverable lines are covered by tests. 🚀 New features to boost your workflow:
|
|
@allroundexperts 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: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2025-10-15.at.11.32.16.PM.movMacOS: Desktop |
|
|
||
| > [!WARNING] | ||
| > **Deprecated**: The `backTo` parameter is deprecated and should not be used in new implementations. Most problems that `backTo` solved can be resolved by adding one or more routes for a single screen. If you don't know how to solve your problem, contact someone from the navigation team. | ||
| > **Deprecated**: The `backTo` parameter is deprecated and should not be used in new implementations. Most problems that `backTo` solved can be resolved by adding one or more routes for a single screen. If you don't know how to solve your problem, contact someone from the navigation team. Old documentation on how to use `backTo` can be found below. |
There was a problem hiding this comment.
| > **Deprecated**: The `backTo` parameter is deprecated and should not be used in new implementations. Most problems that `backTo` solved can be resolved by adding one or more routes for a single screen. If you don't know how to solve your problem, contact someone from the navigation team. Old documentation on how to use `backTo` can be found below. | |
| > **Deprecated**: The `backTo` parameter is deprecated and should not be used in new implementations. Most problems that `backTo` solved can be resolved by adding one or more routes for a single screen. If you don't know how to solve your problem, contact someone from the navigation team. Old documentation on how to use `backTo` can be found below. |
| We should use the following url pattern: | ||
| - FirstNamePage: `/example-form/:firstName` | ||
| - LastNamePage: `/example-form/:firstName/:lastName` | ||
| - DateOfBirthPage: `/example-form/:firstName:/:lastName/:dateOfBirth` |
There was a problem hiding this comment.
I am not so sure about this approach as it could leak PII data https://github.com/Expensify/App/blob/main/contributingGuides/philosophies/ROUTING.md#--should-use-human-readable-names-before-using-ids
cc @MrMuzyk who is working on the form proposal - what was your idea on how to handle this?
There was a problem hiding this comment.
It's super raw but what I had in mind is to just add a subStep param and base it all on static addresses.
Do we want to write any recommendations regarding these forms now?
There was a problem hiding this comment.
I'll remove this section from the PR for now, we can add it later when we decide which method we prefer to implement forms
There was a problem hiding this comment.
It's super raw but what I had in mind is to just add a subStep param and base it all on static addresses.
@MrMuzyk Sorry, I know we had a couple of discussions about this in Slack, but was this specific step discussed? This would technically violate this guideline https://github.com/Expensify/App/blob/main/contributingGuides/philosophies/ROUTING.md#--should-not-use-query-parameters and I am not sure if this applies as exception
Could you please bring that to slack if you think query param like this is the best appraoch?
There was a problem hiding this comment.
but was this specific step discussed? This would technically violate this guideline
We already discussed it briefly and initial response was positive.
Could you please bring that to slack if you think query param like this is the best approach?
Will do :)
|
@mountiny I formatted |
|
@mountiny I solved conflicts here, we're should be ready to merge |
|
🚀 Deployed to staging by https://github.com/mountiny in version: 9.2.37-1 🚀
|
|
🚀 Deployed to production by https://github.com/blimpich in version: 9.2.37-8 🚀
|
Explanation of Change
This PR adds an eslint rule to prevent adding new
backTotypes in theNavigation/types.tsfile and adds a contributing guide toNAVIGATION.mdon how to properly remove backTo from urlScreen.Recording.2025-10-09.at.12.23.32.mov
Fixed Issues
$ #67284
PROPOSAL:
Tests
Offline tests
QA Steps
// TODO: These must be filled out, or the issue title must include "[No QA]."
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectioncanBeMissingparam foruseOnyxtoggleReportand notonIconClick)src/languages/*files and using the translation methodSTYLE.md) were followedAvatar, I verified the components usingAvatarare working as expected)StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))npm run compress-svg)Avataris modified, I verified thatAvataris working as expected in all cases)Designlabel and/or tagged@Expensify/designso 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
Android: mWeb Chrome
iOS: Native
iOS: mWeb Safari
MacOS: Chrome / Safari
MacOS: Desktop