forked from trent_larson/crowd-funder-for-time-pwa
Fix: use route-specific parameter keys in deep link parser
Fix iOS deep link "Invalid Deep Link" error by updating parseDeepLink to use correct parameter keys from ROUTE_MAP instead of always using 'id'. - Replace hardcoded 'id' parameter assignment with dynamic lookup - Use routeConfig.paramKey for route-specific parameter names (e.g., groupId for onboard-meeting-members) - Maintain backward compatibility with fallback to 'id' for routes without explicit paramKey
This commit is contained in:
@@ -130,13 +130,23 @@ export class DeepLinkHandler {
|
||||
const [path, queryString] = parts[1].split("?");
|
||||
const [routePath, ...pathParams] = path.split("/");
|
||||
|
||||
// Parse path parameters
|
||||
// Parse path parameters using route-specific configuration
|
||||
const params: Record<string, string> = {};
|
||||
if (pathParams.length > 0) {
|
||||
params.id = pathParams[0];
|
||||
logger.debug(
|
||||
`[DeepLink] 📍 Path parameter extracted: id=${pathParams[0]}`,
|
||||
);
|
||||
// Get the correct parameter key for this route
|
||||
const routeConfig = ROUTE_MAP[routePath];
|
||||
if (routeConfig?.paramKey) {
|
||||
params[routeConfig.paramKey] = pathParams[0];
|
||||
logger.debug(
|
||||
`[DeepLink] 📍 Path parameter extracted: ${routeConfig.paramKey}=${pathParams[0]}`,
|
||||
);
|
||||
} else {
|
||||
// Fallback to 'id' for backward compatibility
|
||||
params.id = pathParams[0];
|
||||
logger.debug(
|
||||
`[DeepLink] 📍 Path parameter extracted: id=${pathParams[0]} (fallback)`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Parse query parameters
|
||||
|
||||
Reference in New Issue
Block a user