-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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(ssr): correctly call the middleware when rendering error pages #8200
Conversation
|
@@ -12,6 +12,5 @@ export const RedirectComponentInstance: ComponentInstance = { | |||
|
|||
export const RedirectSinglePageBuiltModule: SinglePageBuiltModule = { | |||
page: () => Promise.resolve(RedirectComponentInstance), | |||
onRequest: (ctx, next) => next(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see, there's no need for this stub anymore.
@@ -245,6 +250,7 @@ function buildManifest( | |||
clientDirectives: Array.from(settings.clientDirectives), | |||
entryModules, | |||
assets: staticFiles.map(prefixAssetPath), | |||
middlewareEntryPoint: internals.middlewareEntryPoint?.toString() ?? undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We saved the entry point in the SSR manifest, as it was a route.
5f5de60
to
1c6ad96
Compare
c67f4c5
to
6c76466
Compare
6c76466
to
7715cb6
Compare
Changes
Closes #8154
This fix goes into
next
because it requires some infrastructure that we have there but not inmain
.This PR removes the
onRequest
function from the "ComponentInstance", instead we move its resolution inside the pipeline. The middleware now becomes 100% detached from a page/route.This change fits perfectly because the SSR build already creates a
middleware.mjs
file, and we already save themiddlewareEntryPoint
file.Testing
I created a new test case.
Docs
N/A