Repository navigation
Fix nested array null filtering with stripNulls - #525
Tejas Lamba (TejasLamba2006) wants to merge 1 commit into
Conversation
When stripNulls filters an outer array and assigns the result to obj[k], recursion still visited the old unfiltered array held in value. Switch the recursive call to use obj[k] directly so it always operates on the post-filter value. Added regression tests for nested and flat arrays.
|
Thanks Tejas Lamba (@TejasLamba2006) for this focused fix. The nested-array regression catches the stale-reference bug, and the implementation looks sound in local testing. One improvement I'd recommend is using It would be useful to cover both:
JOJO (@moneymaker26754-crypto), thank you for the earlier work in #496, which already includes these real-validator regression cases and a fix for the same root cause. Please coordinate the overlapping contributions; if the work is consolidated into one PR, let's preserve credit for both authors, including the implementation and regression coverage. Since #496 is itself an open draft PR rather than an issue, "Related to #496" would describe the relationship more accurately than "Fixes #496". |
robgruen
left a comment
There was a problem hiding this comment.
Please see my improvement comment.
|
Can you two (Tejas Lamba (@TejasLamba2006) , JOJO (@moneymaker26754-crypto)) please consolidate into #497 . |
|
Sounds good, happy to consolidate into #497. JOJO (@moneymaker26754-crypto) if you want to pull the nested-array stripNulls fix into your draft, feel free to cherry-pick from this branch or I can push it there directly. Either way works for me, just want to make sure both fixes land. Will update the "Fixes #496" reference to "Related to #496" as suggested. |
When
stripNullsfilters an outer array and assigns the result toobj[k], recursion still visited the old unfiltered array held invalue. Nested replacements were disconnected from the returned structure.The recursive call now uses
obj[k]directly instead of the stalevaluereference, so it always operates on the post-filter array.Added regression tests for nested arrays (
groups: number[][]) and flat arrays to prevent regressions.Related to #496.