react-form-manage 1.0.8-beta.20 → 1.0.8-beta.22

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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,21 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [1.0.8-beta.22] - 2026-02-02
6
+
7
+ ### Changes
8
+ - Refactor: Adjust useFormItemControl and main.tsx for better performance
9
+
10
+ ## [1.0.8-beta.21] - 2026-02-02
11
+
12
+ ### Fixes
13
+ - Patch: Minor adjustments in useFormItemControl
14
+
15
+ ## [1.0.8-beta.20] - 2026-02-02
16
+
17
+ ### Features
18
+ - Trigger `initied` flag for onChange in `useFormItemControl` to properly mark form items as initialized
19
+
5
20
  ## [1.0.8-beta.19] - 2026-02-02
6
21
 
7
22
  ### Features
@@ -80,7 +80,8 @@ function useFormItemControl({ formName, form, name, initialValue, formItemId, ru
80
80
  setListener({
81
81
  formItemId,
82
82
  isDirty: false,
83
- isTouched: false
83
+ isTouched: false,
84
+ isInitied: false
84
85
  });
85
86
  onChange(isNil(value2) ? getInitData(formName || (form == null ? void 0 : form.formName) || (contextForm == null ? void 0 : contextForm.formName), name) : value2, { notTriggerDirty: true, initiedData: true });
86
87
  };
@@ -268,13 +269,11 @@ function useFormItemControl({ formName, form, name, initialValue, formItemId, ru
268
269
  for (const rAsync of ruleToTask) {
269
270
  await rAsync();
270
271
  }
272
+ setListener({ formItemId, internalErrors: listErrors });
271
273
  return listErrors;
272
274
  },
273
275
  deps: [internalRules, value, listener == null ? void 0 : listener.isInitied],
274
276
  enabled: Boolean(listener == null ? void 0 : listener.isInitied),
275
- onSuccess(result) {
276
- setListener({ formItemId, internalErrors: result });
277
- },
278
277
  onError(err) {
279
278
  }
280
279
  });
@@ -282,9 +281,7 @@ function useFormItemControl({ formName, form, name, initialValue, formItemId, ru
282
281
  if (isStateInitied) {
283
282
  if (isNil(value)) {
284
283
  if (isNil(internalInitValue)) {
285
- if (!isNil(initialValue)) {
286
- onInitData(initialValue);
287
- }
284
+ onInitData(initialValue);
288
285
  } else {
289
286
  onChange(internalInitValue, {
290
287
  notTriggerDirty: true,
@@ -307,6 +304,7 @@ function useFormItemControl({ formName, form, name, initialValue, formItemId, ru
307
304
  emitFocus,
308
305
  isTouched: false,
309
306
  isDirty: false,
307
+ isInitied: true,
310
308
  name,
311
309
  formName: formName || (form == null ? void 0 : form.formName) || (contextForm == null ? void 0 : contextForm.formName),
312
310
  formItemId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-form-manage",
3
- "version": "1.0.8-beta.20",
3
+ "version": "1.0.8-beta.22",
4
4
  "description": "Lightweight React form management with list and listener support.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -201,6 +201,7 @@ export default function useFormItemControl<T = any>({
201
201
  formItemId,
202
202
  isDirty: false,
203
203
  isTouched: false,
204
+ isInitied: false,
204
205
  });
205
206
  onChange(
206
207
  isNil(value)
@@ -514,13 +515,13 @@ export default function useFormItemControl<T = any>({
514
515
  await rAsync();
515
516
  }
516
517
 
518
+ setListener({ formItemId, internalErrors: listErrors });
519
+
517
520
  return listErrors;
518
521
  },
519
522
  deps: [internalRules, value, listener?.isInitied],
520
523
  enabled: Boolean(listener?.isInitied),
521
- onSuccess(result) {
522
- setListener({ formItemId, internalErrors: result });
523
- },
524
+
524
525
  onError(err) {
525
526
  console.log(err);
526
527
  },
@@ -544,9 +545,7 @@ export default function useFormItemControl<T = any>({
544
545
 
545
546
  if (isNil(value)) {
546
547
  if (isNil(internalInitValue)) {
547
- if (!isNil(initialValue)) {
548
- onInitData(initialValue);
549
- }
548
+ onInitData(initialValue);
550
549
  } else {
551
550
  onChange(internalInitValue, {
552
551
  notTriggerDirty: true,
@@ -570,6 +569,7 @@ export default function useFormItemControl<T = any>({
570
569
  emitFocus,
571
570
  isTouched: false,
572
571
  isDirty: false,
572
+ isInitied: true,
573
573
  name,
574
574
  formName: formName || form?.formName || contextForm?.formName,
575
575
  formItemId,
package/src/main.tsx CHANGED
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import { createRoot } from "react-dom/client";
2
3
  import App from "./App";
3
4
  import "./index.css";
@@ -7,4 +8,8 @@ if (!container) {
7
8
  throw new Error("Root container missing");
8
9
  }
9
10
 
10
- createRoot(container).render(<App />);
11
+ createRoot(container).render(
12
+ <React.StrictMode>
13
+ <App />
14
+ </React.StrictMode>,
15
+ );