Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dynamic params from query in new router #38466

Merged
merged 6 commits into from Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/next/server/app-render.tsx
Expand Up @@ -421,8 +421,9 @@ export async function renderToHTML(
}

const key = segmentParam.param
const value = pathParams[key]

if (!pathParams[key] && !query[key]) {
if (!value) {
if (segmentParam.type === 'optional-catchall') {
return {
param: key,
Expand All @@ -433,9 +434,6 @@ export async function renderToHTML(
return null
}

// TODO: this should only read from `pathParams`. There's an inconsistency where `query` holds params currently which has to be fixed.
const value = pathParams[key] ?? query[key]

return {
param: key,
value: value,
Expand Down
3 changes: 2 additions & 1 deletion packages/next/server/next-server.ts
Expand Up @@ -732,7 +732,8 @@ export default class NextNodeServer extends BaseServer {
__flight__: query.__flight__,
} as NextParsedUrlQuery)
: query),
...(params || {}),
// For appDir params is excluded.
...((this.nextConfig.experimental.appDir ? {} : params) || {}),
timneutkens marked this conversation as resolved.
Show resolved Hide resolved
},
}
} catch (err) {
Expand Down