Repository navigation
breaking: reducers only see objects; revivers are called once - #247
Closed
elliott-with-the-longest-name-on-github wants to merge 3 commits into
Closed
elliott-with-the-longest-name-on-github wants to merge 3 commits into
elliott-with-the-longest-name-on-github wants to merge 3 commits into
Conversation
|
Install the latest version of pnpm add https://pkg.svelte.dev/devalue/c/2d9f25b963e86e6ebc28f68c16f43545879cae94Open in |
elliott-with-the-longest-name-on-github
added this pull request to stack #249
December 2, 2026 21:04
🦋 Changeset detectedLatest commit: 2d9f25b 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 |
elliott-with-the-longest-name-on-github
force-pushed
the
elliott/new-wire-format
branch
from
December 2, 2026 22:08
b244b93 to
cb278ab
Compare
elliott-with-the-longest-name-on-github
force-pushed
the
elliott/reducer-reviver-api
branch
from
December 2, 2026 22:08
f0f1561 to
a2d30e7
Compare
…wo-stage revivers for cycles
…them in a Set A reference to a custom value whose function reviver hasn't returned, or to a box or view whose contents are still being read, now always throws `Invalid circular reference`.
elliott-with-the-longest-name-on-github
force-pushed
the
elliott/reducer-reviver-api
branch
from
December 2, 2026 22:25
1ee33a8 to
2d9f25b
Compare
elliott-with-the-longest-name-on-github
removed this pull request from stack #249
December 2, 2026 22:26
Contributor
Author
elliott-with-the-longest-name-on-github
deleted the
elliott/reducer-reviver-api
branch
December 2, 2026 22:28
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.
Second of three stacked PRs, on top of #246. It changes the reducer and reviver APIs.
What changes
Reducers only see objects and functions (
reducers-objects-only). Strings, numbers, booleans, BigInts,nullandundefinedare always written as themselves, so they stay on the fast path even when reducers are passed. Functions are tracked by identity, so a reducer that returns its own input is an ordinary cycle. This removes theREDUCER_LOOPerror and its bookkeeping.Revivers are called once, with the whole payload (
two-stage-revivers). A custom value whose payload refers back to the value itself now throwsInvalid circular reference. For types that can contain themselves, a reviver can be{ create, fill }:createmakes the value before its payload is read;fill(value, payload)completes it.The two-stage form also works for revivers named after built-ins. Adds the
ReviverandTwoStageRevivertypes.Refactor: in
parse.js,shadow(name, fallback)returns the built-in's own reader when there is no user reviver, which removes a conditional at each call site. There's no measurable speed or size change.