🥢 feat: extra form values by form state#12936
Merged
bluebill1049 merged 10 commits intomasterfrom Aug 8, 2025
Merged
Conversation
Contributor
|
Size Change: +488 B (+0.88%) Total Size: 55.7 kB
|
Contributor
There was a problem hiding this comment.
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
extractFormValuesutility to filter values by state - Adds
GetValuesConfigtype and overloads toUseFormGetValues - Integrates
extractFormValuesintocreateFormControl.getValuesand 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
dirtyFieldspath to ensureextractFormValuescorrectly filters values whendirtyFieldsis passed.
it('should return extracted form values based on form state', () => {
src/types/form.ts:273
- [nitpick]
EitherOptionmay be ambiguous; consider renaming to something more descriptive likeExclusiveOptionorOneOfOptionsto clarify its purpose.
type EitherOption<T> = {
reports/api-extractor.md.api.md:367
- The public type
GetValuesConfigrelies onEitherOption, butEitherOptionisn'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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close #12931