canvu-react 0.4.74 → 0.4.76
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.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +3 -0
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +3 -0
- package/dist/react.js.map +1 -1
- package/dist/realtimeNative.cjs +5 -3
- package/dist/realtimeNative.cjs.map +1 -1
- package/dist/realtimeNative.js +5 -3
- package/dist/realtimeNative.js.map +1 -1
- package/package.json +1 -1
package/dist/realtimeNative.cjs
CHANGED
|
@@ -471,7 +471,7 @@ function requestRuntimeAnimationFrame(callback) {
|
|
|
471
471
|
}
|
|
472
472
|
function cancelRuntimeAnimationFrame(handle) {
|
|
473
473
|
const runtime = globalThis;
|
|
474
|
-
if (typeof runtime.cancelAnimationFrame === "function") {
|
|
474
|
+
if (typeof runtime.cancelAnimationFrame === "function" && typeof handle === "number") {
|
|
475
475
|
runtime.cancelAnimationFrame(handle);
|
|
476
476
|
return;
|
|
477
477
|
}
|
|
@@ -546,7 +546,7 @@ function useRealtimePeerFollow(options) {
|
|
|
546
546
|
const [, setViewportSizeVersion] = react.useState(0);
|
|
547
547
|
react.useEffect(() => {
|
|
548
548
|
if (!followedPeerId) return;
|
|
549
|
-
let animationFrameId =
|
|
549
|
+
let animationFrameId = null;
|
|
550
550
|
let lastViewportSizeKey = getViewportSizeKey(viewportRef.current ?? null);
|
|
551
551
|
const checkViewportSize = () => {
|
|
552
552
|
const nextViewportSizeKey = getViewportSizeKey(viewportRef.current ?? null);
|
|
@@ -558,7 +558,9 @@ function useRealtimePeerFollow(options) {
|
|
|
558
558
|
};
|
|
559
559
|
animationFrameId = requestRuntimeAnimationFrame(checkViewportSize);
|
|
560
560
|
return () => {
|
|
561
|
-
|
|
561
|
+
if (animationFrameId !== null) {
|
|
562
|
+
cancelRuntimeAnimationFrame(animationFrameId);
|
|
563
|
+
}
|
|
562
564
|
};
|
|
563
565
|
}, [followedPeerId, viewportRef]);
|
|
564
566
|
react.useEffect(() => {
|