Browse Source

fix: Fix error with deep links trying to parse empty query parameters.

pull/142/head
Trent Larson 3 days ago
parent
commit
e0b9481be5
  1. 1
      src/interfaces/deepLinks.ts
  2. 7
      src/services/deepLinks.ts

1
src/interfaces/deepLinks.ts

@ -33,7 +33,6 @@ export const deepLinkSchemas = {
id: z.string(),
}),
"claim-add-raw": z.object({
id: z.string(),
claim: z.string().optional(),
claimJwtId: z.string().optional(),
}),

7
src/services/deepLinks.ts

@ -201,10 +201,9 @@ export class DeepLinkHandler {
// Continue with parameter validation as before...
const schema = deepLinkSchemas[path as keyof typeof deepLinkSchemas];
let validatedParams, validatedQuery;
let validatedParams;
try {
validatedParams = await schema.parseAsync(params);
validatedQuery = await schema.parseAsync(query);
} catch (error) {
// For parameter validation errors, provide specific error feedback
logConsoleAndDb(
@ -230,11 +229,10 @@ export class DeepLinkHandler {
await this.router.replace({
name: routeName,
params: validatedParams,
query: validatedQuery,
});
} catch (error) {
logConsoleAndDb(
`[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)} ... and validated query: ${JSON.stringify(validatedQuery)}`,
`[DeepLink] Error routing to route name ${routeName} for path: ${path}: ${JSON.stringify(error)} ... with validated params: ${JSON.stringify(validatedParams)}`,
true,
);
// For parameter validation errors, provide specific error feedback
@ -245,7 +243,6 @@ export class DeepLinkHandler {
originalPath: path,
errorCode: "ROUTING_ERROR",
errorMessage: `Error routing to ${routeName}: ${JSON.stringify(error)}`,
...validatedQuery,
},
});
}

Loading…
Cancel
Save