react-hook-form 7.43.7 → 7.43.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -278,12 +278,6 @@ function useFormState(props) {
278
278
  });
279
279
  React.useEffect(() => {
280
280
  _mounted.current = true;
281
- const isDirty = control._proxyFormState.isDirty && control._getDirty();
282
- if (isDirty !== control._formState.isDirty) {
283
- control._subjects.state.next({
284
- isDirty,
285
- });
286
- }
287
281
  _localProxyFormState.current.isValid && control._updateValid(true);
288
282
  return () => {
289
283
  _mounted.current = false;
@@ -2168,14 +2162,13 @@ function createFormControl(props = {}, flushRootRender) {
2168
2162
  ...updatedFormState,
2169
2163
  };
2170
2164
  };
2171
- if (isFunction(_options.defaultValues)) {
2165
+ const _resetDefaultValues = () => isFunction(_options.defaultValues) &&
2172
2166
  _options.defaultValues().then((values) => {
2173
2167
  reset(values, _options.resetOptions);
2174
2168
  _subjects.state.next({
2175
2169
  isLoading: false,
2176
2170
  });
2177
2171
  });
2178
- }
2179
2172
  return {
2180
2173
  control: {
2181
2174
  register,
@@ -2189,6 +2182,7 @@ function createFormControl(props = {}, flushRootRender) {
2189
2182
  _updateFieldArray,
2190
2183
  _getFieldArray,
2191
2184
  _reset,
2185
+ _resetDefaultValues,
2192
2186
  _updateFormState,
2193
2187
  _subjects,
2194
2188
  _proxyFormState,
@@ -2312,6 +2306,9 @@ function useForm(props = {}) {
2312
2306
  if (props.values && !deepEqual(props.values, control._defaultValues)) {
2313
2307
  control._reset(props.values, control._options.resetOptions);
2314
2308
  }
2309
+ else {
2310
+ control._resetDefaultValues();
2311
+ }
2315
2312
  }, [props.values, control]);
2316
2313
  React.useEffect(() => {
2317
2314
  if (!control._state.mount) {