Skip to content

fix(core): preserve nullish serialization callback results - #5291

Closed
lfhwnqe wants to merge 1 commit into
wevm:mainfrom
lfhwnqe:fix/serialization-nullish-callbacks
Closed

lfhwnqe wants to merge 1 commit into
wevm:mainfrom
lfhwnqe:fix/serialization-nullish-callbacks

Conversation

@lfhwnqe

@lfhwnqe lfhwnqe commented Nov 5, 2026

Copy link
Copy Markdown

Custom callbacks cannot remove fields or replace values with null: serialize({ target: 'secret' }, (key, value) => key === 'target' ? undefined : value) currently retains target, and deserialize has the same nullish fallback behavior. Apply callback results verbatim when a callback is supplied, preserving the default BigInt/Map conversion when it is absent.

Added callback-result controls for null, undefined, false, 0, and the empty string, including root values, plus one patch changeset for both directions. The eight nullish cases fail before the fix. Existing BigInt, Map, circular-value, indentation, and custom-callback tests continue to pass.

Validation: all 28 targeted tests pass in the original Vitest core project. The original pnpm --filter @wagmi/core check:types, core clean and build, changed-test strict typecheck, changed-file Biome, and git diff --check pass with locked workspace dependencies.

AI assistance: OpenAI Codex assisted with reproduction, implementation, tests, and this description.

@vercel

vercel Bot commented Nov 5, 2026

Copy link
Copy Markdown

@lfhwnqe is attempting to deploy a commit to the Wevm Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot

changeset-bot Bot commented Nov 5, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c4ea06c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@wagmi/core Patch
@wagmi/connectors Patch
wagmi Patch
@wagmi/solid Patch
@wagmi/vue Patch

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

tmm commented Nov 18, 2026

Copy link
Copy Markdown
Member

Thanks for the contribution! Closing for now: this changes how serialize/deserialize callbacks behave for nullish results, and we haven't seen a request for it. If you have a use case that needs it, please open an issue describing it.

@tmm tmm closed this Nov 18, 2026
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.

2 participants