@cjhyy/code-shell-web 0.9.37 → 0.9.38
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.
|
@@ -109,11 +109,28 @@ export function useRemoteApp(options = {}) {
|
|
|
109
109
|
/** Transient banner message (errors, room-missing, …). Auto-clears. */
|
|
110
110
|
const [notice, setNoticeState] = useState();
|
|
111
111
|
const noticeTimer = useRef(undefined);
|
|
112
|
+
const noticeMounted = useRef(true);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
noticeMounted.current = true;
|
|
115
|
+
return () => {
|
|
116
|
+
noticeMounted.current = false;
|
|
117
|
+
if (noticeTimer.current !== undefined)
|
|
118
|
+
clearTimeout(noticeTimer.current);
|
|
119
|
+
noticeTimer.current = undefined;
|
|
120
|
+
};
|
|
121
|
+
}, []);
|
|
112
122
|
const setNotice = useCallback((msg) => {
|
|
123
|
+
if (!noticeMounted.current)
|
|
124
|
+
return;
|
|
113
125
|
setNoticeState(msg);
|
|
114
|
-
if (noticeTimer.current)
|
|
126
|
+
if (noticeTimer.current !== undefined)
|
|
115
127
|
clearTimeout(noticeTimer.current);
|
|
116
|
-
noticeTimer.current = setTimeout(() =>
|
|
128
|
+
noticeTimer.current = setTimeout(() => {
|
|
129
|
+
if (!noticeMounted.current)
|
|
130
|
+
return;
|
|
131
|
+
noticeTimer.current = undefined;
|
|
132
|
+
setNoticeState(undefined);
|
|
133
|
+
}, 5000);
|
|
117
134
|
}, []);
|
|
118
135
|
const beginMobileUpload = useCallback((metadata, expectedGeneration) => {
|
|
119
136
|
return new Promise((resolve, reject) => {
|