@openli1115/lowcode-edit-pro-table 1.0.71 → 1.0.72

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.
@@ -42,15 +42,24 @@ export var FormProvider = function FormProvider(_ref) {
42
42
  values = _useState[0],
43
43
  setValues = _useState[1];
44
44
 
45
- // 仅当 initialValues 引用变化时更新状态
45
+ /**
46
+ * 不能只用 !isEqual:store 对同引用 clone 回灌时,initialValues 是新引用,但与 initialValuesRef 旧对象深比较相等,
47
+ * 会误判「无变化」而不 merge;若表单 values 已是用户 cloneDeep 的副本,不会随原地修改更新 → 逻辑流不回填。
48
+ * 用「引用是否变化」决定是否同步;再用 merged 深比较避免无谓 setState(减轻 Fusion #185)。
49
+ */
46
50
  useEffect(function () {
47
- if (!isEqual(initialValues, initialValuesRef.current)) {
48
- console.log('[FormProvider] 🔄 useEffect triggered - initialValues:', initialValues);
49
- initialValuesRef.current = initialValues;
50
- setValues(function (prev) {
51
- return _extends({}, prev, initialValues);
52
- });
51
+ if (initialValues === initialValuesRef.current) {
52
+ return;
53
53
  }
54
+ console.log('[FormProvider] 🔄 useEffect triggered - initialValues:', initialValues);
55
+ initialValuesRef.current = initialValues;
56
+ setValues(function (prev) {
57
+ var merged = _extends({}, prev, initialValues);
58
+ if (isEqual(prev, merged)) {
59
+ return prev;
60
+ }
61
+ return merged;
62
+ });
54
63
  }, [initialValues]);
55
64
 
56
65
  // 优化 setFieldValue
@@ -73,7 +82,7 @@ export var FormProvider = function FormProvider(_ref) {
73
82
  }
74
83
  return newValues;
75
84
  });
76
- }, []);
85
+ }, [onChange]);
77
86
 
78
87
  // 使用 useMemo 缓存 context 值
79
88
  var contextValue = useMemo(function () {
@@ -48,15 +48,24 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
48
48
  values = _useState[0],
49
49
  setValues = _useState[1];
50
50
 
51
- // 仅当 initialValues 引用变化时更新状态
51
+ /**
52
+ * 不能只用 !isEqual:store 对同引用 clone 回灌时,initialValues 是新引用,但与 initialValuesRef 旧对象深比较相等,
53
+ * 会误判「无变化」而不 merge;若表单 values 已是用户 cloneDeep 的副本,不会随原地修改更新 → 逻辑流不回填。
54
+ * 用「引用是否变化」决定是否同步;再用 merged 深比较避免无谓 setState(减轻 Fusion #185)。
55
+ */
52
56
  useEffect(function () {
53
- if (!(0, _lodash.isEqual)(initialValues, initialValuesRef.current)) {
54
- console.log('[FormProvider] 🔄 useEffect triggered - initialValues:', initialValues);
55
- initialValuesRef.current = initialValues;
56
- setValues(function (prev) {
57
- return (0, _extends2["default"])({}, prev, initialValues);
58
- });
57
+ if (initialValues === initialValuesRef.current) {
58
+ return;
59
59
  }
60
+ console.log('[FormProvider] 🔄 useEffect triggered - initialValues:', initialValues);
61
+ initialValuesRef.current = initialValues;
62
+ setValues(function (prev) {
63
+ var merged = (0, _extends2["default"])({}, prev, initialValues);
64
+ if ((0, _lodash.isEqual)(prev, merged)) {
65
+ return prev;
66
+ }
67
+ return merged;
68
+ });
60
69
  }, [initialValues]);
61
70
 
62
71
  // 优化 setFieldValue
@@ -79,7 +88,7 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
79
88
  }
80
89
  return newValues;
81
90
  });
82
- }, []);
91
+ }, [onChange]);
83
92
 
84
93
  // 使用 useMemo 缓存 context 值
85
94
  var contextValue = useMemo(function () {
@@ -101,7 +101,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
101
101
  packageName = '@openli1115/lowcode-edit-pro-table';
102
102
  }
103
103
  if (version === void 0) {
104
- version = '1.0.71';
104
+ version = '1.0.72';
105
105
  }
106
106
  if (basicLibraryVersion === void 0) {
107
107
  basicLibraryVersion = {
@@ -106,7 +106,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
106
106
  packageName = '@openli1115/lowcode-edit-pro-table';
107
107
  }
108
108
  if (version === void 0) {
109
- version = '1.0.71';
109
+ version = '1.0.72';
110
110
  }
111
111
  if (basicLibraryVersion === void 0) {
112
112
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openli1115/lowcode-edit-pro-table",
3
- "version": "1.0.71",
3
+ "version": "1.0.72",
4
4
  "description": "@openli1115/lowcode-edit-pro-table",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -101,10 +101,10 @@
101
101
  },
102
102
  "componentConfig": {
103
103
  "isComponentLibrary": true,
104
- "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.71/build/lowcode/assets-prod.json"
104
+ "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.72/build/lowcode/assets-prod.json"
105
105
  },
106
106
  "lcMeta": {
107
107
  "type": "component"
108
108
  },
109
- "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.71/build/index.html"
109
+ "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.72/build/index.html"
110
110
  }