gm-datagrid 0.1.3 → 0.1.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.
@@ -16,13 +16,16 @@ interface UseEngineSyncProps {
16
16
  /**
17
17
  * Syncs React state → Wasm engine (push) and pulls page data + subtotals back.
18
18
  *
19
- * Sort, filter and quick-filter are applied INSIDE this hook immediately after
20
- * engine.load_data(), which guarantees the engine's memory is initialised before
21
- * any method is called. This prevents the "memory access out of bounds" WASM
22
- * crash that occurs when those calls are made from a render-body side-effect.
19
+ * IMPORTANT: push and pull are intentionally in ONE effect, not two.
20
+ * wasm-bindgen wraps GridEngine methods with a runtime borrow-check on `&mut self`.
21
+ * Two separate effects that both call engine methods can fire in the same
22
+ * synchronous React flush — the second effect starts before wasm-bindgen has
23
+ * released the `&mut` borrow from the first, triggering:
24
+ * "recursive use of an object detected which would lead to unsafe aliasing in rust"
23
25
  *
24
- * Uses a `dataVersion` ref to skip redundant pulls on re-renders where
25
- * nothing has actually changed in the engine.
26
+ * Keeping everything in a single effect guarantees all engine calls are sequential
27
+ * within one borrow, and the pull (get_page / get_subtotals) always sees the
28
+ * data that was just loaded.
26
29
  */
27
30
  export declare function useEngineSync({ engine, ready, rows, columns, onSynced, page, pageSize, onPageData, sortStack, filterGroup, quickFilterText, }: UseEngineSyncProps): void;
28
31
  export {};