fix(Form): parent not getting dirty after nested field is changed#6545
fix(Form): parent not getting dirty after nested field is changed#6545rdjanuar wants to merge 3 commits into
Conversation
📝 WalkthroughWalkthroughThis PR updates the Form component's Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
commit: |
| if (dirtyFields.size > 0) return true | ||
|
|
||
| for (const form of nestedForms.value.values()) { | ||
| if ((form.api.dirty as any).value) return true |
There was a problem hiding this comment.
Do we really need this as any cast? 🤔
| if ((form.api.dirty as any).value) return true | |
| if (form.api.dirty.value) return true |
027f153 to
ab758a9
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@test/components/Form.spec.ts`:
- Around line 576-577: The test is triggering a change event without awaiting
it, which can cause async flakiness; update the test so the call to
nestedInput.trigger('change') is awaited (i.e., use await
nestedInput.trigger('change')) before calling flushPromises() to ensure the
event is fully dispatched and Vue reactivity runs; locate the trigger call on
the nestedInput element in the Form.spec.ts test and add the await.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 1bac78ba-b8db-44f8-8d2d-3ad8bc17d659
📒 Files selected for processing (2)
src/runtime/components/Form.vuetest/components/Form.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/runtime/components/Form.vue
| nestedInput.trigger('change') | ||
| await flushPromises() |
There was a problem hiding this comment.
Await the change trigger to avoid async test flakiness.
On Line 576, trigger('change') should be awaited. Without it, event dispatch and Vue reactivity scheduling can race with flushPromises() in CI.
Suggested fix
- nestedInput.trigger('change')
+ await nestedInput.trigger('change')
await flushPromises()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| nestedInput.trigger('change') | |
| await flushPromises() | |
| await nestedInput.trigger('change') | |
| await flushPromises() |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@test/components/Form.spec.ts` around lines 576 - 577, The test is triggering
a change event without awaiting it, which can cause async flakiness; update the
test so the call to nestedInput.trigger('change') is awaited (i.e., use await
nestedInput.trigger('change')) before calling flushPromises() to ensure the
event is fully dispatched and Vue reactivity runs; locate the trigger call on
the nestedInput element in the Form.spec.ts test and add the await.

🔗 Linked issue
Resolves #5144
❓ Type of change
📚 Description
📝 Checklist