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

Fix resolving dynamic routes when on returns a redirect #38079

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions packages/next/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1830,8 +1830,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
// Ensure a request to the URL /accounts/[id] will be treated as a dynamic
// route correctly and not loaded immediately without parsing params.
if (!isDynamicRoute(page)) {
const result = await this.renderPageComponent(ctx, bubbleNoFallback)
if (result) return result
return await this.renderPageComponent(ctx, bubbleNoFallback)
}

if (this.dynamicRoutes) {
Expand All @@ -1841,7 +1840,7 @@ export default abstract class Server<ServerOptions extends Options = Options> {
continue
}
page = dynamicRoute.page
const result = await this.renderPageComponent(
return await this.renderPageComponent(
{
...ctx,
pathname: page,
Expand All @@ -1852,7 +1851,6 @@ export default abstract class Server<ServerOptions extends Options = Options> {
},
bubbleNoFallback
)
if (result) return result
}
}
} catch (error) {
Expand Down