ydb-components-material 0.1.166 → 0.1.167

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.
@@ -85,6 +85,8 @@ var FileItem = function FileItem(_ref) {
85
85
  var _React$useState = React.useState(false),
86
86
  needOtherSign = _React$useState[0],
87
87
  setNeedOtherSign = _React$useState[1];
88
+ // 始终保存最新的 needOtherSign,供轮询/异步回调(旧闭包)读取,避免 setInterval 闭包读到挂载时的旧值
89
+ var needOtherSignRef = useRef(false);
88
90
  var _React$useState2 = React.useState(false),
89
91
  isNeedOtherSign = _React$useState2[0],
90
92
  setIsNeedOtherSign = _React$useState2[1];
@@ -106,6 +108,7 @@ var FileItem = function FileItem(_ref) {
106
108
  var otherSignature = safeSignatureSelfRole.includes(OTHER) || safeSignatureAgentRole.includes(OTHER);
107
109
  var otherSeal = safeSignSelfRole.includes(OTHER) || safeSignAgentRole.includes(OTHER);
108
110
  setNeedOtherSign(otherSign);
111
+ needOtherSignRef.current = otherSign;
109
112
  setIsNeedOtherSign(otherSignature);
110
113
  setIsNeedOtherSeal(otherSeal);
111
114
  // 按钮文字按 signerInfo 区分场景:
@@ -605,8 +608,10 @@ var FileItem = function FileItem(_ref) {
605
608
  }
606
609
  valChange(val, fileIndex, index, subIndex);
607
610
  // invalidHandle()
608
- console.log('needOtherSign-----', needOtherSign);
609
- needOtherSign && setShowSignerInfo(true);
611
+ // 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
612
+ var needOther = needOtherSignRef.current;
613
+ console.log('needOtherSign-----', needOther);
614
+ needOther && setShowSignerInfo(true);
610
615
  };
611
616
 
612
617
  // 获取签章结果
@@ -623,7 +628,7 @@ var FileItem = function FileItem(_ref) {
623
628
  }
624
629
  valChange(val, fileIndex, index, subIndex);
625
630
  // invalidHandle()
626
- needOtherSign && setShowSignerInfo(true);
631
+ needOtherSignRef.current && setShowSignerInfo(true);
627
632
  }
628
633
  };
629
634
  var queryFileLibs = function queryFileLibs() {
@@ -91,6 +91,8 @@ var FileItem = function FileItem(_ref) {
91
91
  var _React$useState = _react["default"].useState(false),
92
92
  needOtherSign = _React$useState[0],
93
93
  setNeedOtherSign = _React$useState[1];
94
+ // 始终保存最新的 needOtherSign,供轮询/异步回调(旧闭包)读取,避免 setInterval 闭包读到挂载时的旧值
95
+ var needOtherSignRef = (0, _react.useRef)(false);
94
96
  var _React$useState2 = _react["default"].useState(false),
95
97
  isNeedOtherSign = _React$useState2[0],
96
98
  setIsNeedOtherSign = _React$useState2[1];
@@ -112,6 +114,7 @@ var FileItem = function FileItem(_ref) {
112
114
  var otherSignature = safeSignatureSelfRole.includes(OTHER) || safeSignatureAgentRole.includes(OTHER);
113
115
  var otherSeal = safeSignSelfRole.includes(OTHER) || safeSignAgentRole.includes(OTHER);
114
116
  setNeedOtherSign(otherSign);
117
+ needOtherSignRef.current = otherSign;
115
118
  setIsNeedOtherSign(otherSignature);
116
119
  setIsNeedOtherSeal(otherSeal);
117
120
  // 按钮文字按 signerInfo 区分场景:
@@ -611,8 +614,10 @@ var FileItem = function FileItem(_ref) {
611
614
  }
612
615
  valChange(val, fileIndex, index, subIndex);
613
616
  // invalidHandle()
614
- console.log('needOtherSign-----', needOtherSign);
615
- needOtherSign && setShowSignerInfo(true);
617
+ // 轮询回调是旧闭包,这里读 ref 拿最新值,避免读到挂载时的初始 false
618
+ var needOther = needOtherSignRef.current;
619
+ console.log('needOtherSign-----', needOther);
620
+ needOther && setShowSignerInfo(true);
616
621
  };
617
622
 
618
623
  // 获取签章结果
@@ -629,7 +634,7 @@ var FileItem = function FileItem(_ref) {
629
634
  }
630
635
  valChange(val, fileIndex, index, subIndex);
631
636
  // invalidHandle()
632
- needOtherSign && setShowSignerInfo(true);
637
+ needOtherSignRef.current && setShowSignerInfo(true);
633
638
  }
634
639
  };
635
640
  var queryFileLibs = function queryFileLibs() {
@@ -98,7 +98,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
98
98
  packageName = 'ydb-components-material';
99
99
  }
100
100
  if (version === void 0) {
101
- version = '0.1.166';
101
+ version = '0.1.167';
102
102
  }
103
103
  if (basicLibraryVersion === void 0) {
104
104
  basicLibraryVersion = {
@@ -103,7 +103,7 @@ function fillRealVersion(meta, packageName, version, basicLibraryVersion) {
103
103
  packageName = 'ydb-components-material';
104
104
  }
105
105
  if (version === void 0) {
106
- version = '0.1.166';
106
+ version = '0.1.167';
107
107
  }
108
108
  if (basicLibraryVersion === void 0) {
109
109
  basicLibraryVersion = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ydb-components-material",
3
- "version": "0.1.166",
3
+ "version": "0.1.167",
4
4
  "description": "ydb-components-material",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -102,10 +102,10 @@
102
102
  },
103
103
  "componentConfig": {
104
104
  "isComponentLibrary": true,
105
- "materialSchema": "https://unpkg.com/ydb-components-material@0.1.166/build/lowcode/assets-prod.json"
105
+ "materialSchema": "https://unpkg.com/ydb-components-material@0.1.167/build/lowcode/assets-prod.json"
106
106
  },
107
107
  "lcMeta": {
108
108
  "type": "component"
109
109
  },
110
- "homepage": "https://unpkg.com/ydb-components-material@0.1.166/build/index.html"
110
+ "homepage": "https://unpkg.com/ydb-components-material@0.1.167/build/index.html"
111
111
  }