feat: server function inspector - #2049
Conversation
🦋 Changeset detectedLatest commit: 204e0f7 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 |
✅ Deploy Preview for solid-start-landing-page ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
commit: |
7932c2f to
25b3f44
Compare
4bf69fa to
830f1ce
Compare
be34d27 to
25b0ce5
Compare
820baec to
db436df
Compare
db436df to
0defa47
Compare
860f37b to
8ea8a8b
Compare
c84c5ea to
78c44de
Compare
brenelz
left a comment
There was a problem hiding this comment.
Do we just go ahead with this. I feel its pretty isolated
|
@brenelz yes exactly, it's supposed to be non-blocking. I'm planning on working on the new superfeature for the dev overlay on a separate branch. |
fc77b8b to
ab72e93
Compare
b2926bb to
518af61
Compare
|
Failing tests... Can probably get this merged soon after |
|
@brenelz the PR isn't final so it's expected. I don't think I can finalize this before stable, but I'll still try. |
|
Can maybe target 3.0 then. Thats fine |
|
no not 3.0. This is going to ship in 2.0 perhaps in a minor release, just not the RC |
ca69989 to
fca0400
Compare
|
Changeset missing. |
640ad60 to
0d55980
Compare
|
@birkskyum this is meant to be part of 2.0 |
|
Great, and regarding the main branch, how would you prefer we proceed? do we make a revert, or will you make a follow-up pr with the remaining changes, or is this feature already finished? |
Brings the v2 rc line (through 2.0.0-rc.6) into the Solid 2 branch. Ported main features onto the Solid 2 architecture: - Server-function error handler (#2262): wired through handleServerFunctionRequest's transformResult hook and the solid-start:server-fn-error-handler virtual module. - Custom seroval plugins (#2250): serialization.plugins now feeds the @solidjs/web codec on both the client transport and the server handler. - ~ alias fix for workspace packages (#2239): adopted appRootAlias in place of the global resolve.alias entry. - Dev toolbar (#2049, replaces the dev overlay): ported to Solid 2 (Errored/Loading, onSettled, two-arg createEffect, draft-mutation stores, terracotta 2 subpath imports, @solidjs/web Portal/Dynamic/JSX, createMemo(async) instead of createResource). Protocol-specific pieces (SerovalChunkReader, body-format markers) moved local to the toolbar. - Deferred stream response via h3 iterable() (#2231), StartHandler type (#2234), routerLoad restore (#2228), nonce on streaming redirect script (#2252), ResizeObserver-loop filter (#2240) all kept. Kept deleted (superseded by vite-plugin-solid / @solidjs/web / @solidjs/router server-function integration): fs-routes tree-shake, manifest.ts, directives, fns serialization/registration/shared and their specs. Fixes main landed in those files (#2249, #2238, #2243, #2245, #2241, #2261) live upstream now and are tracked for porting there. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The inspector came over from #2049 built against Start's old fetch transport; on this branch the transport lives in @solidjs/web, so the toolbar's tracker never received a call and its viewers decoded a wire format that no longer exists. - fns/client.ts: in dev, hook the transport's prepareRequest to push each outgoing call (function id + the transport's per-call instance header) and responseHandler.handle to push each response, passing both through untouched. - fns/handler.ts: in dev, echo X-Server-Function-Instance onto the response — the transport doesn't, and it is what lets the inspector pair a response with its request. - body-format.ts: track @solidjs/web's markers (X-Server-Function-Format, the Json format, the new file form key) instead of the old X-Start-Type protocol; the Serialized chunk framing is unchanged, so SerovalViewer keeps working as-is. - functions/index.tsx: add a JsonViewer for plain-JSON bodies (JSON-safe argument lists go over the wire as raw JSON). - dev-toolbar/index.tsx: keep captured instances in a signal-backed plain record instead of a store — Request/Response methods throw "Illegal invocation" when reached through Solid 2's store proxy. Calls made during SSR/hydration are served from the SSR payload without a client fetch, so only real client-initiated calls appear — which is what the inspector is for. Verified against the tests app dev server: onclick and onSettled calls both appear in the panel, request tab shows URL/headers/FormData body, response tab decodes the Serialized stream with status and timing. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
PR Checklist
Server function inspector, keeps track of server function calls and allows you to inspect both Response and Request easier (than viewing the network tab).
Some TODOs:
multipart/form-datainspectorArrayBufferand other content-typesAlso some UI cleanup to dedupe stuff from the current DevOverlay
Testing
The overlay isn't visually-accessible for now so if you want to open it, go to Console then enter__START_SERVER_FN__(true)The inspector is now available in the reworked dev overlay. Design is still to be finalized.
Note
seroval branch doesn't depend on this one, I can rebase this to main when that happens