Repository navigation
fix(web): a server function's ReadableStream result stays a ReadableStream - #5184
Conversation
Since #4985, h, html and element version on their own, so a core release leaves them at a version already on npm. verify-release-artifacts.mjs dry-run-published every public package, and npm refuses even a dry run over a published version, so the 2.0.1 release failed before publishing anything. It now skips a published version the same way release.mjs does, with packageIsPublished shared from release-packages.mjs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMR7ndYUnqBW5NjTbC
…ding on it retryReaches counted a dep that is the source itself as a path even after that source settled, so settleFamily and the re-park sweep in recompute kept a settled derive node in a reader's pending sources. With an optimistic store over one async memo and a slower sibling memo whose re-ask answers unchanged, the reader stayed pending and the action's transaction never landed. A direct link now counts only while the source is pending. Claude-Session: https://claude.ai/code/session_01CP9T3j2CTCEPyTS2bcKsBu
# Conflicts: # packages/signals/docs/RULES-INDEX.md
…#5170) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg
…tream The top-level abort wrapper for streamed results matched any async iterable, so a decoded ReadableStream (which is one in Node and Chrome) was replaced by a plain iterable and lost getReader/pipeTo/tee. Leave a ReadableStream out of that check; it passes through as it already does when nested. Test shape from #5175. Co-authored-by: Marve10s <igrimanigroman@gmail.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg
🦋 Changeset detectedLatest commit: 6669b9a The changes in this PR will be included in the next version bump. This PR includes changesets to release 5 packages
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 |
Size (brotli, eager entry chunk)
|
The instanceof check with its typeof guard cost +59 B minified on every server-function page and put three page scenarios over their caps. A decoded ReadableStream is told apart from an async generator's result by its getReader method. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg
Merging this PR will not alter performance2 warnings
Comparing Footnotes
|
Coverage Report for CI Build 45385145908Coverage remained the same at 79.815%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
Summary
A smaller alternative to #5175 (by @Marve10s), whose test this carries. A server function that returns a
ReadableStreamresolved on the client to a plain{ [Symbol.asyncIterator] }object, sogetReader(),pipeTo()andtee()were missing.The response decodes the stream as a real
ReadableStream(seroval-plugins'ReadableStreamPlugin). The stream was lost afterwards:dispatchServerFunctionwraps any top-level async iterable so that abreakaborts the call, and in Node and Chrome aReadableStreamhasSymbol.asyncIterator, so it was caught too. Safari's has none and kept its stream.The fix skips the wrapper for a result with
getReader, so the decoded stream passes through as it already does when nested in an object. Async generator results keep the wrapper. AgetReadercheck costs fewer bytes thaninstanceof ReadableStreamand needs notypeofguard for runtimes without one. Cancelling a returned stream stops reading but does not abort the call, the same as a nested stream. To cancel the call, useinvoke(fn, { signal }), which aborts the fetch for any result.No public API changes.
How did you test this change?
packages/web/test/server/server-functions-invoke.spec.tsx, adapted from fix(web): a server function's streamed ReadableStream result stays a ReadableStream #5175: the result is aReadableStream,getReader()reads the first chunk, and a producer error rejects the reader. Onmainit fails withexpected { …(1) } to be an instance of ReadableStream, and with the fix it passes.pnpm --dir packages/web exec vitest run --config vite.config.server.mjs test/server/: 2221 passed. The one failure,server-functions-adapter-request"keeps a rebuild failure's own error", also fails onmainin this container (environment).test-typesis left to CI, because the local worktree has no builtsolid-jstypes.🤖 Generated with Claude Code
https://claude.ai/code/session_0117BoWMpyUtA1ZFwzKmr1sg