Skip to content

refactor: rename isValidated to isUserValidated#246

Open
logaretm wants to merge 1 commit intomainfrom
refactor/rename-isValidated-to-isUserValidated
Open

refactor: rename isValidated to isUserValidated#246
logaretm wants to merge 1 commit intomainfrom
refactor/rename-isValidated-to-isUserValidated

Conversation

@logaretm
Copy link
Copy Markdown
Member

Summary

  • Renames isValidated to isUserValidated and setIsValidated to setIsUserValidated across the field state API
  • Clarifies that this state tracks user-initiated validation (blur, change, or submit), not programmatic validate() calls
  • Includes changeset for minor version bump

Closes #243

Test plan

  • All existing tests updated and passing (lint-staged ran them on commit)
  • Build succeeds
  • Typecheck passes

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 15, 2026 05:28
@changeset-bot
Copy link
Copy Markdown

changeset-bot bot commented Mar 15, 2026

🦋 Changeset detected

Latest commit: 229f92a

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@formwerk/core Minor
@formwerk/devtools Minor

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

@logaretm logaretm force-pushed the refactor/rename-isValidated-to-isUserValidated branch from 12d7809 to 1805c41 Compare March 15, 2026 05:29
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 isValidated to isUserValidated (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.

Comment on lines 145 to 151
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);
});
});
Comment on lines 509 to 520
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>
@logaretm logaretm force-pushed the refactor/rename-isValidated-to-isUserValidated branch from 1805c41 to 229f92a Compare March 15, 2026 05:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isValidated not set on manual validation

2 participants