fix: treat null and arrays as non-mergeable in mergeJson - #13147
Open
tonycoder-hub wants to merge 1 commit into
Open
fix: treat null and arrays as non-mergeable in mergeJson#13147tonycoder-hub wants to merge 1 commit into
tonycoder-hub wants to merge 1 commit into
Conversation
typeof null === "object", so a null in the second config was recursed into instead of replacing the first object, silently dropping explicit nulls. Arrays hit the same branch when only one side was an array, either ignoring the second value or producing an array/object hybrid. Co-authored-by: Tony Coder <407243179@qq.com>
Contributor
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
I have read the CLA Document and I hereby sign the CLA |
Author
|
recheck |
cursor
Bot
force-pushed
the
cursor/fix-mergejson-null-and-array-type-mismatch-573d
branch
from
August 17, 2026 10:44
37f2e71 to
3b9ce7d
Compare
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.
Description
mergeJson used typeof value === "object" so null and arrays were treated as mergeable objects.
That produced three incorrect results:
isMergeableObject now gates recursion. On a type mismatch, the second value wins.
Distinct from #13143, #13144, #13145, and #13146.
Checklist
Tests
core/util/merge.test.ts: 14 passed