Skip to content

fix: query.live remote functions use SSE instead of ndjson stream (#15921)#15956

Closed
IAkumaI wants to merge 1 commit into
sveltejs:mainfrom
IAkumaI:main
Closed

fix: query.live remote functions use SSE instead of ndjson stream (#15921)#15956
IAkumaI wants to merge 1 commit into
sveltejs:mainfrom
IAkumaI:main

Conversation

@IAkumaI

@IAkumaI IAkumaI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

closes #15921

query.live had problems with some proxies on client side which blocked the stream indefinitely.
Now it uses SSE headers and data format (but kept usual fetch) and should bypass those proxies.


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@changeset-bot

changeset-bot Bot commented Jun 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 20b2ec3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@svelte-docs-bot

Copy link
Copy Markdown

* Each yielded value is the raw `JSON.parse`'d object from a `data:` field.
* @param {ReadableStreamDefaultReader<Uint8Array>} reader
*/
export async function* read_sse(reader) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems pretty identical to read_ndjson... is there any way to share the logic?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I followed the existing style of the code.

I would say that if we do combine them to one, it'd be too...confusing. Monstrous reading-everything function with if if if? I'm not sure.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have it fixed locally, but I think you need to check the "Allow edits from maintainers" setting on your end so I can push up the fix

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. It's because your branch is named main, and it has branch protections, so it's not allowed to be pushed to 😆 One of GitHub's strange quirks. I'm going to push this up to another branch for review; you'll still get credit for your contributions!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to #15957; will close this one

Rich-Harris added a commit that referenced this pull request Jun 5, 2026
…rmal streamed responses (#15957)

closes #15956
closes #15921
closes (maybe) #15790?

Some middlemen (antivirus, nginx) do weird buffer-y things with streamed
responses, in spite of the no-store cache directives we use. SSE is more
universal and seems to bypass some of these behaviors. TBD on whether
this works for the nginx issue.

Due to weird GitHub quirks I couldn't push to @IAkumaI's branch. This
still contains his commits.

---------

Co-authored-by: Akuma <meru.no.akuma@gmail.com>
Co-authored-by: Rich Harris <rich.harris@vercel.com>
Co-authored-by: Rich Harris <richard.a.harris@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

query.live stucks in pending state when wrong proxies at client side

2 participants