[v2] Fix: Keep ArrayField in sync after array replacement - #2356
[v2] Fix: Keep ArrayField in sync after array replacement#2356scttcper wants to merge 2 commits into
Conversation
Replacing an array with another array of the same length updated form state without rerendering ArrayField. Bump the shared array version for direct replacements while keeping nested field updates isolated. Co-Authored-By: OpenAI Codex <noreply@openai.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
💤 Files with no reviewable changes (1)
Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe change centralizes ChangesArray version tracking
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change makes equal-length array replacements rerender correctly while preserving nested field behavior and is merge-ready after normal checks and review; no actionable merge-blocking risk remains. Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| expect(input).toHaveValue('new-value') | ||
| }) | ||
|
|
||
| it('rerenders an ArrayField for a same-length replacement', () => { |
There was a problem hiding this comment.
this test does fail without the change
|
View your CI Pipeline Execution ↗ for commit e409b42
☁️ Nx Cloud last updated this comment at |
ArrayFieldonly reacts to array length and_arrayVersion, so replacing an array with a different array of the same length updated form state without rerendering the array container. UI rendered from the array could stay stale while submission used the new values.This bumps
_arrayVersionfor direct same-length replacements. Array helpers now rely on length changes or this shared behavior instead of manually updating the version, while nested field updates still avoid rerendering the parentArrayField.Summary by CodeRabbit
Bug Fixes
Tests