@kanunilabs/pivotgrid-react / usePivotController
Function: usePivotController()
usePivotController<
TRow>(options,attachedTo?):PivotController<TRow>
The grid's controller, kept for the life of the component (per gridId).
B.108: React runs the same effect cleanup when <Activity mode="hidden"> hides the grid as when it unmounts it;
what differs is the DOM. An unmount removes the grid's element in the commit, before the cleanups; a hide keeps it
(display: none). So, with attachedTo (the grid's element, captured at setup — React detaches refs on hide):
- element gone →
dispose(), as before B.108; - element still there →
suspend()after 0 ms (StrictMode's cleanup + setup in one task cancels it), and a check every 5 s disposes it after two misses in a row (a grid unmounted while hidden gets no second cleanup). The setupresume()s. A controller found disposed there (a host that took the hidden element out of the page, an app's owndispose()) is replaced by a fresh one with the old one's layout state: a reset, never a dead grid. The engine starts on the firstresume()(start: 'resume'), so a controller React throws away never claims a worker. WithoutattachedTothe cleanup only suspends.
Type Parameters
TRow
TRow
Parameters
options
PivotControllerOptions<TRow>
attachedTo?
RefObject<Element | null>
Returns
PivotController<TRow>