@chromahq/react 1.0.22 → 1.0.23
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.
- package/dist/index.js +6 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -236,6 +236,12 @@ const BridgeProvider = ({
|
|
|
236
236
|
const statusRef = useRef(status);
|
|
237
237
|
const bridgeRef = useRef(bridge);
|
|
238
238
|
const isMountedRef = useRef(true);
|
|
239
|
+
useEffect(() => {
|
|
240
|
+
isMountedRef.current = true;
|
|
241
|
+
return () => {
|
|
242
|
+
isMountedRef.current = false;
|
|
243
|
+
};
|
|
244
|
+
}, []);
|
|
239
245
|
useEffect(() => {
|
|
240
246
|
statusRef.current = status;
|
|
241
247
|
}, [status]);
|
|
@@ -549,7 +555,6 @@ const BridgeProvider = ({
|
|
|
549
555
|
};
|
|
550
556
|
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
551
557
|
return () => {
|
|
552
|
-
isMountedRef.current = false;
|
|
553
558
|
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
554
559
|
clearTimeoutSafe(maxRetryCooldownRef);
|
|
555
560
|
cleanup();
|