Repository navigation
Description
Describe the bug
When a mutation's single-flight data includes a server component, the response fails to encode instead of streaming the component's markup.
foldFlightData (packages/web/server-functions/src/server.ts) builds the flight data keyed by consumer id, Object.fromEntries(folded), so an unnamed collector's slice arrives as { "true": { [key]: value } }. frameTransformFlightResult (packages/web/frames/src/frame-sink.ts) only looks for component values at the top level of data. It sees "true" mapped to an object, finds no regions, and returns undefined. The handler then falls back to the plain codec, which throws on the component function:
Server function result could not be encoded: The value [object Function] of type "function" cannot be parsed/serialized.
In production the stream ends with !{"message":"Internal Server Error"}. The response still has status 200 and x-single-flight: true, so the client gets a failed action.
This breaks every single-flight mutation that revalidates a server component, including @solidjs/router's createFlightDataCollector with serverRouteComponent routes and file-system server pages. I hit it in an app using @solidjs/[email protected]. The same code is on next at dcca7d4.
Your Example Website or App
The standalone script below uses only @solidjs/web.
Steps to Reproduce the Bug or Issue
With @solidjs/[email protected] and [email protected] installed, run node repro.mjs (or node --conditions=development repro.mjs for the dev message):
import {
configureServerFunctionsServer,
handleServerFunctionRequest,
registerServerReference,
createServerReference
} from "@solidjs/web/server-functions/server";
import {
frameTransformResult,
frameTransformDirectResult,
frameTransformFlightResult
} from "@solidjs/web/frames/server";
import { provideRequestEvent } from "@solidjs/web/storage";
// A server component's resolved value (what a query cache entry holds): a component.
const View = () => "fresh markup";
createServerReference(registerServerReference("mutate-1", async () => "ok"));
configureServerFunctionsServer({
provideEvent: provideRequestEvent,
transformResult: frameTransformResult,
transformDirectResult: frameTransformDirectResult,
transformFlightResult: frameTransformFlightResult,
// The unnamed collector: one invalidated key whose value is markup.
collectFlightData: async () => ({ "view[]": View })
});
const res = await handleServerFunctionRequest(
new Request("http://localhost/_server/data/mutate-1", {
method: "POST",
headers: {
"content-type": "application/json",
origin: "http://localhost",
"sec-fetch-site": "same-origin",
"x-server-function-format": "3",
"x-single-flight": "true"
},
body: "[]"
})
);
console.log(res.status, res.headers.get("content-type"), "x-single-flight:", res.headers.get("x-single-flight"));
console.log(await res.text());
// The transform itself, given the two data shapes.
const flat = await frameTransformFlightResult(null, { value: "ok", data: { "view[]": View } });
const keyed = await frameTransformFlightResult(null, { value: "ok", data: { true: { "view[]": View } } });
console.log("flat data ->", flat?.headers.get("content-type"));
console.log("keyed data ->", keyed);Output:
200 text/plain x-single-flight: true
;0x00000170;!{"message":"Server function result could not be encoded: The value [object Function] of type \"function\" cannot be parsed/serialized. ..."}
flat data -> application/x-frame-stream
keyed data -> undefined
The last two lines isolate the mismatch. Given flat data, the transform returns a frame stream. Given the consumer-keyed shape that foldFlightData actually passes, it returns undefined.
Expected behavior
The response should be an application/x-frame-stream that carries View's markup as a region, with the { value, data } outcome referencing it, the same as when the transform gets flat data. frameTransformFlightResult should look one level down, into each consumer's slice, for component-valued entries, and keep the consumer keys in the data it serializes so the client can still route each slice to its consumer.
Screenshots or Videos
None.
Platform
- OS: macOS 15 (Darwin 24.3.0)
- Runtime: Node 24.21.0, server side, no browser needed to reproduce
- Versions:
@solidjs/[email protected],[email protected]; the same code is onnextat dcca7d4
Activity
fix(web): single-flight delivery is one shared path; frame transform …
ryansolid commentedon Sep 24, 2026