@seafile/sdoc-editor 0.3.28 → 0.3.29

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.
@@ -28,6 +28,7 @@ const RevisionOperations = _ref => {
28
28
  const [isShowTip, setShowTip] = useState(false);
29
29
  const [tipType, setTipType] = useState('');
30
30
  const [mergeValue, setMergeValue] = useState(null);
31
+ const [isLoading, setLoading] = useState(false);
31
32
  const {
32
33
  loadDocument
33
34
  } = useDocument();
@@ -72,6 +73,8 @@ const RevisionOperations = _ref => {
72
73
 
73
74
  // solve show change view in revision editor
74
75
  const onViewChangesToggle = useCallback(isShowChanges => {
76
+ if (isLoading) return;
77
+ setLoading(true);
75
78
  if (!isPublished && isShowChanges) {
76
79
  // The trick here is to send one more api request in order to use the same information box.
77
80
  loadDocument().then(revisionContent => {
@@ -82,13 +85,16 @@ const RevisionOperations = _ref => {
82
85
  } else {
83
86
  handleViewChangesToggle(isShowChanges);
84
87
  }
88
+ setLoading(false);
85
89
  }).catch(errorMessage => {
86
90
  toaster.danger(t(errorMessage));
91
+ setLoading(false);
87
92
  });
88
93
  return;
89
94
  }
90
95
  handleViewChangesToggle(isShowChanges);
91
- }, [handleViewChangesToggle, loadDocument, t, isPublished]);
96
+ setLoading(false);
97
+ }, [handleViewChangesToggle, loadDocument, t, isPublished, isLoading]);
92
98
 
93
99
  // publish revision
94
100
  const publishRevision = useCallback(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "0.3.28",
3
+ "version": "0.3.29",
4
4
  "private": false,
5
5
  "description": "This is a sdoc editor",
6
6
  "main": "dist/index.js",