Skip to content

[BT-010] Add Propagation of Derived Parameters to Dynamic Routes State #85055

@mjasikowski

Description

@mjasikowski

Description

Current State:

  • Dynamic routes do not propagate parameters from the base route into the dynamic suffix's navigation state
  • When a dynamic suffix screen needs access to a parameter from the base route (e.g., reportID from r/:reportID), there is no built-in way to access it
  • This leads to workarounds such as custom hooks to extract parameters from the URL, as seen in migrate REPORT_SETTINGS_NAME #85034

Expected State:

  • Parameters from the base route should be automatically derived and propagated into the dynamic suffix screen's navigation state
  • For example, when navigating to r/123456/verify-account, the verify-account dynamic screen should receive reportID: 123456 as a derived parameter without requiring additional hooks
  • This eliminates the need for workarounds and simplifies dynamic route consumption

Implementation:

  • When building navigation state for a dynamic suffix in getAdaptedStateFromPath, extract parameters from the resolved base route state
  • Propagate these derived parameters into the dynamic suffix screen's params
  • Define which parameters should be propagated in the DYNAMIC_ROUTES configuration (or derive them automatically from the base route's param list)
  • Update the DynamicVerifyAccountPage and similar components to consume derived params directly from route params

Context:

  • Discovered during migrate REPORT_SETTINGS_NAME #85034 where reportID is needed from the base route
  • Currently requires an additional hook to extract the parameter, which this feature would eliminate

Scope

Files:

  • App/src/libs/Navigation/helpers/getAdaptedStateFromPath.ts - Propagate base route params to dynamic suffix state
  • App/src/ROUTES.ts - Optionally define derived parameter mappings in DYNAMIC_ROUTES
  • App/src/libs/Navigation/types.ts - Update dynamic route param types to include derived params
  • Dynamic route components that need base route parameters

Dependencies:

Issue OwnerCurrent Issue Owner: @collectioneur

Metadata

Metadata

Labels

InternalRequires API changes or must be handled by Expensify staffReviewingHas a PR in reviewWeeklyKSv2

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions