fix nuxt useForm#21
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
🚧 Files skipped from review as they are similar to previous changes (4)
📝 WalkthroughWalkthroughForm display bindings were migrated from ChangesForm Value Migration and Reactive Bridge
Sequence Diagram(s)sequenceDiagram
participant UI as Client UI
participant Adapter as Nuxt Adapter (values bridge)
participant Form as Form Instance
participant Vue as Vue reactive runtime
UI->>Adapter: read `form.values.field` (render)
Note right of Adapter: Adapter getters read latest form.values via versioned bridge
UI->>Adapter: onInput -> call `form.fields.field.onInput(value)`
Adapter->>Form: `form.value.setValue(path, value)`
Form->>Form: update internal state & run validations/subscribers
Form->>Adapter: notify subscriber (new values)
Adapter->>Vue: update `rawValues` and bump version (reactive)
Vue->>UI: reactive update triggers re-render showing updated `form.values.field`
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
apps/blog-nuxt/pages/reset-password.vue (1)
26-26: 💤 Low valueUse
:valueinstead ofv-modelfor the hidden token input.
<input type="hidden">never firesinputevents, so the update half ofv-modelis a no-op. The SvelteKit equivalent correctly uses a one-wayvalue={form.values.token}binding. Prefer:value="form.values.token"here for semantic accuracy.♻️ Proposed fix
- <input name="token" type="hidden" v-model="form.values.token"> + <input name="token" type="hidden" :value="form.values.token">🤖 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 `@apps/blog-nuxt/pages/reset-password.vue` at line 26, Replace the two-way binding on the hidden token input with a one-way value binding: change the input that currently uses v-model="form.values.token" to use :value="form.values.token" so the hidden input reflects the token without relying on input events; locate the input element referencing form.values.token and update it accordingly, and remove any now-unused assumptions about v-model updating this field elsewhere (keep using form.values.token as the source of truth).
🤖 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 `@apps/docs/docs/forms/client-usage.md`:
- Around line 211-213: The note incorrectly states that
form.fields.email.onBlur() is the touched-state bridge; update the wording to
clarify that onBlur() is the blur-validation hook used when validateOn: 'blur',
while touched state can also be set during input/value updates (e.g., via
form.values.email changes and form.fields.email.onInput), and apply the same
rewording to the corresponding note in server-validation.md so both files
consistently distinguish blur-triggered validation from general touched-state
transitions.
In `@packages/adapter-nuxt/src/runtime/composables/forms.ts`:
- Around line 33-38: Arrays are incorrectly treated as leaf values by
isLeafValue, so mutating methods on form.values arrays bypass the accessor
setter and never call setValue; update isLeafValue to not return true for arrays
and modify the accessor logic that exposes form.values (the bridge
getter/setter) to wrap returned arrays in a mutation-trapping proxy that
intercepts mutating methods (push, pop, splice, shift, unshift, sort, reverse,
fill, copyWithin) and calls the existing setValue/form client update path so
touched/dirty/validation/subscribers run; add a unit test that calls
form.values.tags.push(...) and asserts touched, dirty and validation state
update.
---
Nitpick comments:
In `@apps/blog-nuxt/pages/reset-password.vue`:
- Line 26: Replace the two-way binding on the hidden token input with a one-way
value binding: change the input that currently uses v-model="form.values.token"
to use :value="form.values.token" so the hidden input reflects the token without
relying on input events; locate the input element referencing form.values.token
and update it accordingly, and remove any now-unused assumptions about v-model
updating this field elsewhere (keep using form.values.token as the source of
truth).
🪄 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: 2efcced5-5c73-4eb9-85c0-5e9ae7d551be
📒 Files selected for processing (22)
apps/blog-next/app/forgot-password/page.tsxapps/blog-next/app/login/page.tsxapps/blog-next/app/register/page.tsxapps/blog-next/app/reset-password/page.tsxapps/blog-next/app/verify-email/page.tsxapps/blog-nuxt/pages/forgot-password.vueapps/blog-nuxt/pages/login.vueapps/blog-nuxt/pages/register.vueapps/blog-nuxt/pages/reset-password.vueapps/blog-nuxt/pages/verify-email.vueapps/blog-sveltekit/src/routes/forgot-password/+page.svelteapps/blog-sveltekit/src/routes/login/+page.svelteapps/blog-sveltekit/src/routes/register/+page.svelteapps/blog-sveltekit/src/routes/reset-password/+page.svelteapps/blog-sveltekit/src/routes/verify-email/+page.svelteapps/docs/docs/forms/client-usage.mdapps/docs/docs/forms/server-validation.mdpackages/adapter-nuxt/src/runtime/composables/forms.tspackages/adapter-nuxt/src/vue-shim.d.tspackages/adapter-nuxt/tests/client.test.tspackages/forms/src/client.tspackages/forms/tests/client.test.ts
|
@CodeRabbit review |
✅ Actions performedReview triggered.
|
Summary by CodeRabbit
Bug Fixes
Documentation
Refactor
Tests