Repository navigation
Conversation
|
|
👷 Deploy request for solid-docs-v2 pending review.Visit the deploys page to approve it
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description(required)
Since
@solidjs/vite-plugin3.0.0-next.48, start-mode middleware is(event, next)(StartMiddleware), the request isevent.request, andnext()takes no arguments. Several pages still showed the earlier(request, next)shape andnext(request). Copied as written, they break the app: the first argument is the event, sorequest.urlisundefined, andnext(request)turns every page into a500.Changes:
attachCustomer,securityHeaders,requireHttps,catchErrors), the "replace the request" paragraph (now: assignevent.request, with an example), the deep-dive line and the recap. The module export usessatisfies StartMiddleware[]like thefullstacktemplate.requireAccountSessionreadsevent.requestandevent.locals.attachCustomerwritesevent.locals.StartOptionsreference: themiddlewaretype, plus three lines onevent.request,next()and per-request render inputs.redirect()from@solidjs/webinstead ofResponse.redirect().Response.redirect()returns immutable headers. With the guide'ssecurityHeadersearlier in the chain, a guard's redirect (the protected-routes one, for example) threw aTypeErrorand answered500. Verified in dev. Two "Common problems" entries cover both errors.I left out the
filesystem-routing/apireference. Itssource_refisv0.2.1, and in 0.5.0createAPIHandlertakesRequest | { request }, so it works in the chain either way. It probably wants a re-sync rather than a hand edit.How I checked it (solid-js / @solidjs/web 2.0.3, @solidjs/vite-plugin 3.0.1, filesystem-routing 0.5.0):
src/middleware.tswithcreateAPIHandler(routes)at the end, type-check asStartMiddleware[]with 0 errors. OnlygetSessionand thesign-inpath were stubbed.vite dev:/returns 200 withx-frame-options: DENY;/account/orders?x=1signed out returns 302 to/sign-in?next=%2Faccount%2Forders%3Fx%3D1, with the header; theevent.requestrewrite serves the target page; no errors are logged.Response.redirect()answered that guarded request with500(TypeError: immutable).prettier --checkon the changed files,pnpm lint:tone(0 errors) andpnpm check:typespass, and the four pages render undervite dev.Related issues & labels
(request, next)shape; start mode now calls(event, next)andnext(request)throws #1716 (all pages except thefilesystem-routing/apireference, see above)🤖 Generated with Claude Code