[NO QA] Add Propagation of Derived Parameters to Dynamic Routes State#85079
Conversation
| name: currentRoute ?? '', | ||
| path, | ||
| params, | ||
| ...(mergedParams ? {params: mergedParams} : {}), |
There was a problem hiding this comment.
NAB: can't we create params object above, and here just pass it?
|
@hungvu193 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] |
Codecov Report✅ Changes either increased or maintained existing code coverage, great job!
|
|
@collectioneur Please ping me when it's ready. |
|
Oops I'm testing this. Just to confirm doesn this need C+ review 😂 @mjasikowski ? Otherwise, please unassign me here |
|
@hungvu193 sorry, auto assigner is crazy today. @huult will be doing the review |
Reviewer Checklist
Screenshots/VideosAndroid: HybridAppAndroid: mWeb ChromeiOS: HybridAppiOS: mWeb SafariMacOS: Chrome / SafariScreen.Recording.2026-03-13.at.21.54.39.mov |
| // If this is the last route, create leaf node with path | ||
| // If this is the last route, create leaf node with path and merged params | ||
| if (currentIndex === routes.length - 1) { | ||
| const mergedParams = parentRouteParams || params ? {...parentRouteParams, ...params} : undefined; |
There was a problem hiding this comment.
I checked this yesterday and noticed that params can possibly be undefined. Spreading undefined may cause a runtime error: TypeError: Cannot convert undefined or null to object.
So to make this safer, I would recommend adding a fallback {}.
const mergedParams = parentRouteParams || params
? {...(parentRouteParams ?? {}), ...(params ?? {})}
: undefined;|
🚧 @mjasikowski has triggered a test Expensify/App build. You can view the workflow run here. |
|
🧪🧪 Use the links below to test this adhoc build on Android, iOS, and Web. Happy testing! 🧪🧪
|
|
✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release. |
Explanation of Change
Propagate parent route params to dynamic route leaf nodes.
getStateForDynamicRoutenow accepts an optionalparentRouteParamsargument and merges it with query params on the leaf node.getStateFromPathpasses the focused route's params through. Now dynamic routes retain all parent context in the navigation state.Fixed Issues
$ #85055
Tests
/settings/profile/address/country?country=UScountryquery parameter is preserved (the correct country is pre-selected)No QA
Offline tests
N/A
QA Steps
No QA
PR Author Checklist
### Fixed Issuessection aboveTestssectionOffline stepssectionQA stepssectiontoggleReportand 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