/** * Hydrate `CustomDataGrid`'s internal page / pageSize / sort state from cache * and persist user-driven paging / sorting changes back to cache. * * Parents are expected to read cached grid state themselves via * `useRestoredInitialState` and seed their own pagination / sort state. * This hook does NOT push cached values up to the parent — it only seeds the * grid's own internal state. * * Page number is persisted under `currentPage`. (`pageIndex` was persisted and * then removed in May 2026 because a restored page could disagree with the * page the parent fetched; old `pageIndex` values may still sit in browsers, * so that key is deliberately never read.) Consistency now comes from: * - `useRestoredInitialState` returning `page`, so the parent's first fetch * uses the same page the grid restores; * - sorting, searching and filtering resetting the stored page to 1; * - CustomDataGrid clamping a restored page that is past the last page; * - `persistPage: false` for any view that shares a page counter with * something else (e.g. an infinite-scroll tile view). * * @param {string} tableId * @param {object} opts */ export function useRestoredGridState(tableId: string, { gpPageSettings, gpSortKey, gpSortDir, pageIndex, propPageSize, columns, persistPage }: object): { page: any; setPage: import("react").Dispatch; pageSize: any; setPageSize: import("react").Dispatch; sortKey: any; direction: any; initialPrefs: any; onPaging: (args: any, currentPageSize: any) => void; onSorting: (args: any, fallbackSortKey: any) => void; savePage: (index: any) => void; };