@omnigrid/react 0.1.15 → 0.1.16

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.
Files changed (2) hide show
  1. package/dist/useGrid.js +7 -7
  2. package/package.json +1 -1
package/dist/useGrid.js CHANGED
@@ -72,17 +72,17 @@ export function useGrid(options) {
72
72
  grid.setColumns(options.columns);
73
73
  }
74
74
  }, [grid, options.columns]);
75
- // Sync loading state. When `options.loading` is true, show the loading
76
- // overlay; when false, hide it (auto-overlays like noRows take over).
77
- const loadingSyncedRef = useRef(false);
75
+ // Sync loading state. An explicit boolean prop always wins and is applied
76
+ // on every change (including the first flush — the Grid constructor may
77
+ // have been created with a stale value). `undefined` means the host does
78
+ // not manage loading: the core or a plugin (e.g. InfiniteScrollPlugin
79
+ // during its initial fetch in register()) may own the state, and the prop
80
+ // must not stomp it with a forced `false`.
78
81
  useEffect(() => {
79
82
  if (grid.isDestroyed())
80
83
  return;
81
- if (!loadingSyncedRef.current) {
82
- loadingSyncedRef.current = true;
83
- grid.setLoading(!!options.loading);
84
+ if (options.loading === undefined)
84
85
  return;
85
- }
86
86
  grid.setLoading(!!options.loading);
87
87
  }, [grid, options.loading]);
88
88
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@omnigrid/react",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "React adapter and renderer for OmniGrid",
5
5
  "keywords": [
6
6
  "omnigrid",