@openli1115/lowcode-edit-pro-table 1.0.62 → 1.0.63

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,12 +42,24 @@ export var FormProvider = function FormProvider(_ref) {
42
42
  values = _useState[0],
43
43
  setValues = _useState[1];
44
44
 
45
+ /** 每次渲染同步,供 initialValues effect 判断「store 是否只是回灌了当前表单已有数据」 */
46
+ var valuesRef = useRef(values);
47
+ valuesRef.current = values;
48
+
45
49
  /**
46
50
  * store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
47
- * 会整页重渲染(含 EditProTable 几十行),Fusion Overlay/Select componentDidUpdate 里反复 setPosition,
48
- * 易触发 React #185(Maximum update depth exceeded),Windows 上更明显。
51
+ * 会整页重渲染(含 EditProTable、ss_xxx_tab 等大表),Fusion Overlay/Select 反复 setPosition,
52
+ * 易触发 React #185(Maximum update depth exceeded)。
53
+ *
54
+ * 仅与 initialValuesRef 比较不够:用户改字段后 onChange 已把同一份数据写回 store,若此时再 merge,
55
+ * 或与内表 mutate 的 window.screenStructures 产生细微差异,会反复 setValues 形成环。
56
+ * 因此:initialValues 与当前表单 values 深度相等时,一律不再 setValues。
49
57
  */
50
58
  useEffect(function () {
59
+ if (isEqual(initialValues, valuesRef.current)) {
60
+ initialValuesRef.current = initialValues;
61
+ return;
62
+ }
51
63
  if (isEqual(initialValues, initialValuesRef.current)) {
52
64
  initialValuesRef.current = initialValues;
53
65
  return;
@@ -48,12 +48,24 @@ var FormProvider = exports.FormProvider = function FormProvider(_ref) {
48
48
  values = _useState[0],
49
49
  setValues = _useState[1];
50
50
 
51
+ /** 每次渲染同步,供 initialValues effect 判断「store 是否只是回灌了当前表单已有数据」 */
52
+ var valuesRef = useRef(values);
53
+ valuesRef.current = values;
54
+
51
55
  /**
52
56
  * store 每次 dispatch 都会给新的 screenStructures 引用;若内容与表单 state 实际一致仍 setValues,
53
- * 会整页重渲染(含 EditProTable 几十行),Fusion Overlay/Select componentDidUpdate 里反复 setPosition,
54
- * 易触发 React #185(Maximum update depth exceeded),Windows 上更明显。
57
+ * 会整页重渲染(含 EditProTable、ss_xxx_tab 等大表),Fusion Overlay/Select 反复 setPosition,
58
+ * 易触发 React #185(Maximum update depth exceeded)。
59
+ *
60
+ * 仅与 initialValuesRef 比较不够:用户改字段后 onChange 已把同一份数据写回 store,若此时再 merge,
61
+ * 或与内表 mutate 的 window.screenStructures 产生细微差异,会反复 setValues 形成环。
62
+ * 因此:initialValues 与当前表单 values 深度相等时,一律不再 setValues。
55
63
  */
56
64
  useEffect(function () {
65
+ if ((0, _lodash.isEqual)(initialValues, valuesRef.current)) {
66
+ initialValuesRef.current = initialValues;
67
+ return;
68
+ }
57
69
  if ((0, _lodash.isEqual)(initialValues, initialValuesRef.current)) {
58
70
  initialValuesRef.current = initialValues;
59
71
  return;
@@ -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.62';
104
+ version = '1.0.63';
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.62';
109
+ version = '1.0.63';
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.62",
3
+ "version": "1.0.63",
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.62/build/lowcode/assets-prod.json"
104
+ "materialSchema": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.63/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.62/build/index.html"
109
+ "homepage": "https://unpkg.com/@openli1115/lowcode-edit-pro-table@1.0.63/build/index.html"
110
110
  }