-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Closed
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2InternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staff
Description
Description
Current State:
- Navigation to verify-account routes uses direct route constants with
backToparameters - Example:
Navigation.navigate(ROUTES.SETTINGS_WALLET_VERIFY_ACCOUNT.getRoute(backTo)) - The
backToparameter is embedded in the URL, creating complex nested URLs
Expected State:
- Add
createDynamicRoute()function toNavigation.ts - Function should:
- Validate that the provided suffix exists in
DYNAMIC_ROUTES - Get the current active route via
getActiveRoute() - Separate the path from query parameters
- Append the dynamic suffix to the path
- Reattach query parameters
- Return the combined route
- Validate that the provided suffix exists in
Implementation:
function createDynamicRoute(suffix: DynamicRouteSuffix): Route {
if (!isValidSuffix(suffix)) {
throw new Error(`Invalid dynamic route suffix: ${suffix}`);
}
const activePath = getActiveRoute();
return combinePathAndSuffix(activePath, suffix);
}
// Helper: Combines path and suffix while preserving query params
function combinePathAndSuffix(path: string, suffix: string): Route {
const [basePath, queryString] = path.split('?');
const newPath = `${basePath}/${suffix}`;
return queryString ? `${newPath}?${queryString}` : newPath;
}Usage Example:
// Old way
Navigation.navigate(ROUTES.SETTINGS_WALLET_VERIFY_ACCOUNT.getRoute(backTo));
// New way
Navigation.navigate(createDynamicRoute(DYNAMIC_ROUTES.VERIFY_ACCOUNT.path));Scope
Files:
App/src/libs/Navigation/Navigation.ts- AddcreateDynamicRoute()andcombinePathAndSuffix()functions
Dependencies:
Issue Owner
Current Issue Owner: @mallenexpensifyReactions are currently unavailable
Metadata
Metadata
Labels
BugSomething is broken. Auto assigns a BugZero manager.Something is broken. Auto assigns a BugZero manager.DailyKSv2KSv2InternalRequires API changes or must be handled by Expensify staffRequires API changes or must be handled by Expensify staff