fix: handle renderer.run rejections#17591
Merged
Rich-Harris merged 5 commits intosveltejs:mainfrom Jan 30, 2026
Merged
Conversation
🦋 Changeset detectedLatest commit: 06989f3 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 |
6 tasks
Rich-Harris
reviewed
Jan 29, 2026
Contributor
|
Merged
7nik
pushed a commit
that referenced
this pull request
Jan 30, 2026
* fix: handle renderer run rejections * add test * changeset * simplify * explanatory comment --------- Co-authored-by: Antonio Bennett <abennett@mabelslabels.com> Co-authored-by: Rich Harris <rich.harris@vercel.com>
7nik
added a commit
that referenced
this pull request
Feb 4, 2026
* fix: emit `each_key_duplicate` error in production * fix: preserve key * Update packages/svelte/src/internal/client/dom/blocks/each.js Co-authored-by: Rich Harris <rich.harris@vercel.com> * Update packages/svelte/src/internal/client/dom/blocks/each.js Co-authored-by: Rich Harris <rich.harris@vercel.com> * fix: ensure keys are validated * fix silly test name * fix: cover other case of duplicate keys * emit error on hydration * ensure the error is handled * drop useless tests * unused * finish merge * add lost check back * chore: bump playwright (#17565) * chore: bump playwright * maybe this will help somehow? * err whatever * fix * chore: allow testing in production env 2 (#17590) * Revert "chore: allow testing in production env (#16840)" This reverts commit ffd65e9. * new approach * fix: handle renderer.run rejections (#17591) * fix: handle renderer run rejections * add test * changeset * simplify * explanatory comment --------- Co-authored-by: Antonio Bennett <abennett@mabelslabels.com> Co-authored-by: Rich Harris <rich.harris@vercel.com> * fix: only create async functions in SSR output when necessary (#17593) * fix: only create async functions in SSR output when necessary * actually... * simplify generated code a bit more * simplify * fix: merge consecutive text nodes during hydration for large text content (#17587) * fix: merge consecutive text nodes during hydration for large text content Fixes #17582 Browsers automatically split text nodes exceeding 65536 characters into multiple consecutive text nodes during HTML parsing. This causes hydration mismatches when Svelte expects a single text node. The fix merges consecutive text nodes during hydration by: - Detecting when the current node is a text node - Finding all consecutive text node siblings - Merging their content into the first text node - Removing the extra text nodes This restores correct hydration behavior for large text content. * add test, fix * fix * fix * changeset --------- Co-authored-by: Miner <miner@example.com> Co-authored-by: Rich Harris <rich.harris@vercel.com> * Version Packages (#17585) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> * Revert "drop useless tests" This reverts commit 65f77ef. * update tests * fix test * we don't need to expose this function any more * figured it out... we cant have errors during reconcile * simplify * tweak * unused * revert no-longer-needed change * unused --------- Co-authored-by: Rich Harris <rich.harris@vercel.com> Co-authored-by: Antonio Bennett <31296212+Antonio-Bennett@users.noreply.github.com> Co-authored-by: Antonio Bennett <abennett@mabelslabels.com> Co-authored-by: FORMI <239411042+Richman018@users.noreply.github.com> Co-authored-by: Miner <miner@example.com> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.
Summary
Renderer.run()as handled to prevent unhandled rejectionsrenderer.promiseso async SSR waits for itContext
Renderer.run()starts async work and returns the promise chain, but the work isn’t associated withrenderer.promiseand no rejection handler is attached. When a render-timeRedirect(or other error) happens before the render is awaited, Node reports an unhandled rejection. This adds a no-op catch to mark the chain as handled and wires it into the renderer’s async tracking so the rejection still surfaces when awaited.How This Relates To SvelteKit
This addresses the root unhandled-rejection cause observed in SvelteKit when a render-time
redirect()happens (e.g. via remotequery). The companion Kit PR (linked below) handlesRedirectduring render so it becomes a proper redirect response rather than a 500.Notes
Related
Test Plan
redirect()(via SvelteKit remote query) no longer triggers unhandled rejection