Repository navigation
Conversation
A request-scoped channel read one value ahead of its consumers. A producer that waits for a change after its first yield was therefore parked in that wait when the document took the first value and left; the closing return() queued behind the pending next() and the producer's finally never ran, one suspended producer per request. Pull from the producer on these channels only when a consumer is waiting for a value, so it rests at its yield, where return() reaches it. Client channels keep reading ahead.
🦋 Changeset detectedLatest commit: 766d3d9 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 |
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.
After a server render, the producer behind a
liveQueryis left suspended and itsfinallynever runs. This closes it when the document has taken its first value.next()again right after delivering a value. The README's producer shape (a firstyield, thenfor awaitover a watch) is then parked in its wait when the document takes the first value and leaves, and the closingreturn()queues behind that pendingnext(). One suspended producer per rendered page, against "the producer still closes with its last consumer".yield, wherereturn()reaches it. Client channels still read ahead. Includes a patch changeset.live()server function is never finalized after the response ends (thereturn()queues behind a read-aheadnext()) #751.pnpm exec vitest run --config vitest.config.server.ts test/server/live-query-ssr.spec.tsadds a producer that waits forever after its first yield and checks itsfinallyhas run after the last consumer returned (fails on main, passes here), plus a consumer that pulls to the end. Rendering a memo over the query withrenderToStringandrenderToStreaminside a request event leaves 1 open producer on main (2next(), 1return(), the ratio in the report) and 0 with this change.pnpm run test(762 client and 112 server tests, types),pnpm buildand the dist type check pass.Fixes #751