refactor: rename isValidated to isUserValidated#246
Conversation
🦋 Changeset detectedLatest commit: 229f92a The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
12d7809 to
1805c41
Compare
There was a problem hiding this comment.
Pull request overview
This PR refactors the field state API to rename isValidated/setIsValidated to isUserValidated/setIsUserValidated, clarifying that the flag represents user-initiated validation (blur/change/submit) rather than programmatic validate() calls, and includes a changeset to publish the breaking rename as a minor bump.
Changes:
- Rename field state/exposed field API from
isValidatedtoisUserValidated(and setter accordingly). - Update validity-tracking logic call sites to use the new setter name.
- Update unit tests and add a changeset for the version bump.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/validation/useInputValidity.ts | Updates validity event handlers to set isUserValidated. |
| packages/core/src/validation/useInputValidity.spec.ts | Renames tests/assertions to the new isUserValidated flag. |
| packages/core/src/useFormField/useFormField.ts | Updates the exposed field API and its docs to isUserValidated. |
| packages/core/src/useFormField/useFormField.spec.ts | Updates field-state tests to the new naming and semantics. |
| packages/core/src/useFormField/useFieldState.ts | Renames the internal field-state property/setter and submit behavior to isUserValidated. |
| .changeset/rename-isvalidated-to-isuservalidated.md | Adds a minor-version changeset documenting the rename. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| watch(opts.field.fieldValue, async () => { | ||
| await updateValidity(); | ||
| // Field value change is user interaction - mark as validated | ||
| nextTick(() => { | ||
| opts.field.setIsValidated(true); | ||
| opts.field.setIsUserValidated(true); | ||
| }); | ||
| }); |
| export function useFieldIsValidated() { | ||
| // Right now, there is no need to track it in a form. | ||
| const isValidated = ref(false); | ||
| const isUserValidated = ref(false); | ||
|
|
||
| function setIsValidated(value: boolean) { | ||
| isValidated.value = value; | ||
| function setIsUserValidated(value: boolean) { | ||
| isUserValidated.value = value; | ||
| } | ||
|
|
||
| return { | ||
| isValidated, | ||
| setIsValidated, | ||
| isUserValidated, | ||
| setIsUserValidated, | ||
| }; |
Clarifies that this state tracks user-initiated validation (blur, change, or submit) rather than programmatic validation calls. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1805c41 to
229f92a
Compare
Summary
isValidatedtoisUserValidatedandsetIsValidatedtosetIsUserValidatedacross the field state APIvalidate()callsCloses #243
Test plan
🤖 Generated with Claude Code