Files
docmost/apps/client/src/ee/base/context/grid-row-order.tsx
T
Philipinho 572452c80b feat: bases
Add the bases feature: formula engine package, grid/table UI, and the base-embed editor extension, with supporting client and server changes.
2026-06-13 01:26:37 +01:00

13 lines
490 B
TypeScript

import { createContext, useContext } from "react";
// Row order is only needed at interaction time (shift-select range math), so
// rows subscribe to a stable getter instead of the array itself — appending a
// page must not re-render every mounted row.
const GridRowOrderContext = createContext<() => string[]>(() => []);
export const GridRowOrderProvider = GridRowOrderContext.Provider;
export function useGridRowOrder(): () => string[] {
return useContext(GridRowOrderContext);
}