Route path-addressed server function calls - #332
Draft
ryansolid wants to merge 2 commits into
Draft
Conversation
solidjs/solid#3076 moved the function id into the path (`<endpoint>/<id>`), retiring the X-Server-Function-Id header and the `?id=` query fallback. The dev middleware and the generated dispatchRequest gate matched the endpoint pathname exactly, so the new addresses fell through to SSR; both now match by mount prefix (exact or `endpoint + '/'`). The dev middleware's module-preload id comes from the path segment, with the header and `?id=` forms kept as fallbacks for a client runtime older than the addressing change. Verified end-to-end against the fullstack-tanstack template with the solid `next` runtime linked in: GET-declared reads (GET and HEAD), 405/403 gating, and the unscripted no-JS form POST flow (303 + flash) all dispatch through the new addresses in dev. Co-authored-by: Cursor <cursoragent@cursor.com>
🦋 Changeset detectedLatest commit: 027ff50 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
2 tasks
commit: |
…table Co-authored-by: Cursor <cursoragent@cursor.com>
Member
Author
|
Per review: the header/ |
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.
Summary
Downstream adoption of solidjs/solid#3076: a server function call's address is now
<endpoint>/<id>with arguments in the query, and theX-Server-Function-Idheader and?id=fallback left the wire.server-functions/index.ts): the endpoint gate matched the pathname exactly, so path-addressed calls fell through to SSR. It now matches by mount prefix (exact orendpoint + '/'), for both the base-prefixed and base-stripped forms. The module-preload function id comes from the path segment; the header and?id=forms stay as fallbacks for a client runtime older than the addressing change.ssr/index.ts): the emitteddispatchRequestcomposed server functions only atpathname === endpoint; it now prefix-matches the same way. A bare-mount request still routes to the runtime handler, which answers the 404 — a misaddressed post fails through the endpoint rather than rendering a page at it.Draft until
@solidjs/webpublishes the addressing change (anything newer than2.0.0-rc.3). The plugin change is backward-compatible on its own — exact-match and the fallback id channels keep an older runtime working.Test plan
fullstack-tanstacktemplate with the solidnextruntime linked in: GET-declared reads over/_server/<id>(GET returns data + defaultno-store, HEAD returns bodyless 200), undeclared reads gated (403/405), and the unscripted no-JS form POST flow (303 + flash cookie) all dispatch through the dev middleware.@solidjs/webprerelease is published.Companion PR: solidjs/solid-router#590.
Made with Cursor