@giteeteam/apps-team-components 1.1.4 → 1.1.5

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.
@@ -31,9 +31,13 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
31
31
  const [fetching, setFetching] = useState(true);
32
32
  const [approval, setApproval] = useState(cloneDeep(DEFAULT_APPROVAL_DATA));
33
33
  const [checkIn, setCheckIn] = useState(cloneDeep(DEFAULT_CHECK_IN_DATA));
34
+ const newItem = useRef(itemId);
34
35
  useEffect(() => {
35
36
  setStatusId(objectId);
36
- }, [objectId]);
37
+ return () => {
38
+ newItem.current = itemId;
39
+ };
40
+ }, [itemId, objectId]);
37
41
  const { checkTransitionScript, getWorkflowData, getItemStatus, runTransition } = useWorkflowConfig();
38
42
  const { currentUser } = useCurrentUser();
39
43
  const [groupIds, roleIds, workspaceRoleIds] = useWorkflowPermission((_a = itemData === null || itemData === void 0 ? void 0 : itemData.workspace) === null || _a === void 0 ? void 0 : _a.objectId);
@@ -95,14 +99,17 @@ const TransitionPanel = ({ itemId, itemType, workspace, objectId, onTransitionSu
95
99
  logger('updateWorkflowMessage', statusId);
96
100
  updateWorkflowMessage(workflowData, statusId);
97
101
  }, [statusId]);
98
- const refreshItem = (status) => {
102
+ const refreshItem = useCallback((status) => {
103
+ if (newItem.current !== itemId) {
104
+ return;
105
+ }
99
106
  setStatusId(status.objectId);
100
107
  onTransitionSuccess === null || onTransitionSuccess === void 0 ? void 0 : onTransitionSuccess(status);
101
108
  itemMutate();
102
109
  proximaSdk.execute('updateStatusLog');
103
110
  proximaSdk.execute('updateApprovalInfo', status.objectId);
104
111
  proximaSdk.execute('updateCheckInInfo', status.objectId);
105
- };
112
+ }, [itemId, itemMutate, onTransitionSuccess]);
106
113
  const submitHandle = useCallback(async (transitionText, itemDetail = null) => {
107
114
  const params = {
108
115
  workflowId: workflowData.objectId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@giteeteam/apps-team-components",
3
- "version": "1.1.4",
3
+ "version": "1.1.5",
4
4
  "description": "Gitee team components",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",