@techninja/clearstack 0.3.10 → 0.3.11
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.
|
@@ -478,25 +478,11 @@ re-fetches automatically.
|
|
|
478
478
|
### Debouncing Batch Operations
|
|
479
479
|
|
|
480
480
|
Operations like drag-to-reorder send multiple PUTs, each triggering an SSE
|
|
481
|
-
event. Without debouncing, each event clears the store
|
|
482
|
-
re-render while the previous render is still pending — causing cascading
|
|
483
|
-
errors.
|
|
481
|
+
event. Without debouncing, each event clears the store mid-render.
|
|
484
482
|
|
|
485
483
|
The `connectRealtime()` utility debounces by entity type: multiple SSE
|
|
486
|
-
events within 300ms trigger only one `store.clear()`.
|
|
487
|
-
|
|
484
|
+
events within 300ms trigger only one `store.clear()`. A reorder of 5 tasks
|
|
485
|
+
sends 5 PUTs → 5 SSE events → 1 store clear after the batch settles.
|
|
488
486
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const timers = {};
|
|
492
|
-
source.addEventListener('update', (event) => {
|
|
493
|
-
const { type } = JSON.parse(event.data);
|
|
494
|
-
clearTimeout(timers[type]);
|
|
495
|
-
timers[type] = setTimeout(() => {
|
|
496
|
-
store.clear([Model]); // one clear after the batch settles
|
|
497
|
-
}, 300);
|
|
498
|
-
});
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
For the local user, the UI should not call `store.clear()` explicitly
|
|
502
|
-
after batch operations — let the debounced SSE handler do it once.
|
|
487
|
+
For the local user, don't call `store.clear()` explicitly after batch
|
|
488
|
+
operations — let the debounced SSE handler do it once.
|
package/package.json
CHANGED
|
@@ -478,25 +478,11 @@ re-fetches automatically.
|
|
|
478
478
|
### Debouncing Batch Operations
|
|
479
479
|
|
|
480
480
|
Operations like drag-to-reorder send multiple PUTs, each triggering an SSE
|
|
481
|
-
event. Without debouncing, each event clears the store
|
|
482
|
-
re-render while the previous render is still pending — causing cascading
|
|
483
|
-
errors.
|
|
481
|
+
event. Without debouncing, each event clears the store mid-render.
|
|
484
482
|
|
|
485
483
|
The `connectRealtime()` utility debounces by entity type: multiple SSE
|
|
486
|
-
events within 300ms trigger only one `store.clear()`.
|
|
487
|
-
|
|
484
|
+
events within 300ms trigger only one `store.clear()`. A reorder of 5 tasks
|
|
485
|
+
sends 5 PUTs → 5 SSE events → 1 store clear after the batch settles.
|
|
488
486
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
const timers = {};
|
|
492
|
-
source.addEventListener('update', (event) => {
|
|
493
|
-
const { type } = JSON.parse(event.data);
|
|
494
|
-
clearTimeout(timers[type]);
|
|
495
|
-
timers[type] = setTimeout(() => {
|
|
496
|
-
store.clear([Model]); // one clear after the batch settles
|
|
497
|
-
}, 300);
|
|
498
|
-
});
|
|
499
|
-
```
|
|
500
|
-
|
|
501
|
-
For the local user, the UI should not call `store.clear()` explicitly
|
|
502
|
-
after batch operations — let the debounced SSE handler do it once.
|
|
487
|
+
For the local user, don't call `store.clear()` explicitly after batch
|
|
488
|
+
operations — let the debounced SSE handler do it once.
|