Skip to content

🥢 feat: extra form values by form state#12936

Merged
bluebill1049 merged 10 commits intomasterfrom
feat/getValues-options
Aug 8, 2025
Merged

🥢 feat: extra form values by form state#12936
bluebill1049 merged 10 commits intomasterfrom
feat/getValues-options

Conversation

@bluebill1049
Copy link
Copy Markdown
Member

@bluebill1049 bluebill1049 commented Jul 5, 2025

close #12931

getValues(undefined, {
  dirtyFields: true
  // touchedFields: true,
})

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jul 5, 2025

Size Change: +488 B (+0.88%)

Total Size: 55.7 kB

Filename Size Change
dist/index.cjs.js 11 kB +78 B (+0.71%)
dist/index.esm.mjs 20.5 kB +160 B (+0.79%)
dist/index.umd.js 11.1 kB +78 B (+0.71%)
dist/react-server.esm.mjs 13 kB +172 B (+1.34%)

compressed-size-action

@bluebill1049 bluebill1049 marked this pull request as draft July 5, 2025 02:36
@bluebill1049 bluebill1049 requested a review from Copilot July 5, 2025 23:31
Copy link
Copy Markdown
Contributor

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 adds support for returning extra form values based on form state (dirty or touched) via a new GetValuesConfig option.

  • Introduces extractFormValues utility to filter values by state
  • Adds GetValuesConfig type and overloads to UseFormGetValues
  • Integrates extractFormValues into createFormControl.getValues and updates tests & API report

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/utils/extractFormValues.ts New helper to recursively extract form values based on state
src/types/form.ts Defined EitherOption & GetValuesConfig, updated getValues overloads
src/logic/createFormControl.ts Wired GetValuesConfig into getValues implementation
src/tests/utils/extractFormValues.test.ts Added unit test for extractFormValues
reports/api-extractor.md.api.md Updated API extractor output for new types
package.json Tweaked test script flags
Comments suppressed due to low confidence (3)

src/tests/utils/extractFormValues.test.ts:4

  • Consider adding a test for the dirtyFields path to ensure extractFormValues correctly filters values when dirtyFields is passed.
  it('should return extracted form values based on form state', () => {

src/types/form.ts:273

  • [nitpick] EitherOption may be ambiguous; consider renaming to something more descriptive like ExclusiveOption or OneOfOptions to clarify its purpose.
type EitherOption<T> = {

reports/api-extractor.md.api.md:367

  • The public type GetValuesConfig relies on EitherOption, but EitherOption isn't exported from the entry point. Please add it to the package exports or adjust the API so no internal type is leaked.
// Warning: (ae-forgotten-export) The symbol "EitherOption" needs to be exported by the entry point index.d.ts

Comment thread src/utils/extractFormValues.ts Outdated
@bluebill1049 bluebill1049 marked this pull request as ready for review August 8, 2025 23:50
@bluebill1049 bluebill1049 merged commit b2a9545 into master Aug 8, 2025
6 checks passed
@bluebill1049 bluebill1049 deleted the feat/getValues-options branch August 8, 2025 23:56
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.

feature: Built-in form data extraction strategies

2 participants