canvu-react 0.4.3 → 0.4.4
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/realtime.cjs +7 -0
- package/dist/realtime.cjs.map +1 -1
- package/dist/realtime.js +7 -0
- package/dist/realtime.js.map +1 -1
- package/package.json +1 -1
package/dist/realtime.cjs
CHANGED
|
@@ -3513,6 +3513,7 @@ function useRealtimeCanvasDocument(options) {
|
|
|
3513
3513
|
const [loading, setLoading] = react.useState(false);
|
|
3514
3514
|
const lastAppliedRevisionRef = react.useRef(null);
|
|
3515
3515
|
const inFlightRevisionRef = react.useRef(null);
|
|
3516
|
+
const hasEverPropagatedItemsRef = react.useRef(false);
|
|
3516
3517
|
const realtimeEnabled = enabled && session != null;
|
|
3517
3518
|
const documentRevision = session?.document?.revision ?? null;
|
|
3518
3519
|
const documentItems = session?.document?.items;
|
|
@@ -3551,6 +3552,12 @@ function useRealtimeCanvasDocument(options) {
|
|
|
3551
3552
|
if (cancelled) return;
|
|
3552
3553
|
if (inFlightRevisionRef.current !== documentRevision) return;
|
|
3553
3554
|
lastAppliedRevisionRef.current = documentRevision;
|
|
3555
|
+
if (resolvedItems.length === 0 && hasEverPropagatedItemsRef.current) {
|
|
3556
|
+
return;
|
|
3557
|
+
}
|
|
3558
|
+
if (resolvedItems.length > 0) {
|
|
3559
|
+
hasEverPropagatedItemsRef.current = true;
|
|
3560
|
+
}
|
|
3554
3561
|
onItemsChange(resolvedItems);
|
|
3555
3562
|
}).finally(() => {
|
|
3556
3563
|
if (inFlightRevisionRef.current === documentRevision) {
|