Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📷 improve form values state update #10029

Merged
merged 3 commits into from
Mar 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"jest-preview": "^0.3.1",
"jest-watch-typeahead": "^2.2.1",
"lint-staged": "^13.1.0",
"prettier": "^2.8.2",
"react": "^18.2.0",
Expand Down
48 changes: 0 additions & 48 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions reports/api-extractor.md
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,6 @@ export type UseFormProps<TFieldValues extends FieldValues = FieldValues, TContex
shouldUseNativeValidation: boolean;
criteriaMode: CriteriaMode;
delayError: number;
formControl: ReturnType<typeof createFormControl>;
}>;

// @public
Expand Down Expand Up @@ -787,9 +786,8 @@ export type WatchObserver<TFieldValues extends FieldValues> = (value: DeepPartia

// Warnings were encountered during analysis:
//
// src/types/form.ts:98:3 - (ae-forgotten-export) The symbol "AsyncDefaultValues" needs to be exported by the entry point index.d.ts
// src/types/form.ts:108:3 - (ae-forgotten-export) The symbol "createFormControl" needs to be exported by the entry point index.d.ts
// src/types/form.ts:421:3 - (ae-forgotten-export) The symbol "Subscription" needs to be exported by the entry point index.d.ts
// src/types/form.ts:97:3 - (ae-forgotten-export) The symbol "AsyncDefaultValues" needs to be exported by the entry point index.d.ts
// src/types/form.ts:419:3 - (ae-forgotten-export) The symbol "Subscription" needs to be exported by the entry point index.d.ts

// (No @packageDocumentation comment for this package)

Expand Down
4 changes: 0 additions & 4 deletions scripts/jest/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,4 @@ module.exports = {
'!**/__tests__/**',
],
projects: getProjects(),
watchPlugins: [
'jest-watch-typeahead/filename',
'jest-watch-typeahead/testname',
],
};
4 changes: 2 additions & 2 deletions src/logic/createFormControl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1154,11 +1154,11 @@ export function createFormControl<
: cloneUpdatedValues;

_subjects.array.next({
values,
values: { ...values },
});

_subjects.values.next({
values,
values: { ...values },
});
}

Expand Down
2 changes: 0 additions & 2 deletions src/types/form.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React from 'react';

import { createFormControl } from '../logic/createFormControl';
import { Subject, Subscription } from '../utils/createSubject';

import { ErrorOption, FieldError, FieldErrors } from './errors';
Expand Down Expand Up @@ -105,7 +104,6 @@ export type UseFormProps<
shouldUseNativeValidation: boolean;
criteriaMode: CriteriaMode;
delayError: number;
formControl: ReturnType<typeof createFormControl>;
}>;

export type FieldNamesMarkedBoolean<TFieldValues extends FieldValues> = DeepMap<
Expand Down
2 changes: 1 addition & 1 deletion src/useFieldArray.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ export function useFieldArray<

control._subjects.values.next({
name,
values: control._formValues,
values: { ...control._formValues },
});

control._names.focus &&
Expand Down