MCPcopy Create free account
hub / github.com/bvaughn/react-virtualized / onCommit

Function onCommit

lib/components/MultiGrid/MultiGrid.tsx:240–267  ·  view source on GitHub ↗
(columnWidth: CellSize, rowHeight: CellSize)

Source from the content-addressed store, hash-verified

238
239 // Called after every commit of the MultiGrid (the equivalent of the 9.x componentDidMount/componentDidUpdate)
240 const onCommit = (columnWidth: CellSize, rowHeight: CellSize) => {
241 // Most of the inner Grids receive wrapped (function) cell sizes, which Grid can't compare;
242 // so a change of a numeric size is passed on by recomputing them (as Grid does for its own numeric sizes).
243 const committedSizes = internals.committedSizes;
244 internals.committedSizes = { columnWidth, rowHeight };
245 if (
246 committedSizes !== null &&
247 (isNumericSizeChange(committedSizes.columnWidth, columnWidth) ||
248 isNumericSizeChange(committedSizes.rowHeight, rowHeight))
249 ) {
250 recomputeGrids(0, 0);
251 }
252
253 // Cell sizes invalidated by CellMeasurer (see invalidateCellSizeAfterRender)
254 if (typeof internals.deferredInvalidateColumnIndex === "number") {
255 const columnIndex = internals.deferredInvalidateColumnIndex;
256 // Always set alongside the column index (by invalidateCellSizeAfterRender)
257 const rowIndex = internals.deferredInvalidateRowIndex as number;
258
259 internals.deferredInvalidateColumnIndex = null;
260 internals.deferredInvalidateRowIndex = null;
261
262 handle.recomputeGridSize({ columnIndex, rowIndex });
263 }
264
265 // E.g. a fixed Grid that has just been added (because the fixed row or column count changed)
266 syncFixedGridScrollPositions();
267 };
268
269 // The bottom-right Grid has been scrolled
270 const onScroll = (scrollInfo: ScrollInfo) => {

Callers 1

MultiGrid.tsxFile · 0.85

Calls 4

recomputeGridsFunction · 0.85
isNumericSizeChangeFunction · 0.70
recomputeGridSizeMethod · 0.65

Tested by

no test coverage detected