diff --git a/packages/frontend/src/lib/nirax.ts b/packages/frontend/src/lib/nirax.ts index 70db47e24e..74dda9decd 100644 --- a/packages/frontend/src/lib/nirax.ts +++ b/packages/frontend/src/lib/nirax.ts @@ -165,6 +165,8 @@ function buildFullPath(args: { const replaceRegex = new RegExp(`:${key}(\\?)?`, 'g'); fullPath = fullPath.replace(replaceRegex, value ? encodeURIComponent(value) : ''); } + // remove any optional parameters that are not provided + fullPath = fullPath.replace(/\/:\w+\?(?=\/|$)/g, ''); } if (args.query) {