gridcn2.0.0
Rows and live data

Read a push verdict

Read how many cells a push wrote, which patches the grid skipped and why, and when an async schema settles the batch.

updateCells and updateRows check every patch. The verdict tells you what the grid wrote and what it skipped. See Push live values for the call.

updateCells and updateRows return an UpdateCellsVerdict:

  • applied counts the cells the call wrote.
  • skipped holds one UpdateCellsSkip per patch that the grid checked and did not write, with its patchIndex and a reason. Two patches to one cell in one batch count once, and the last one wins.
  • pending is true while an async schema holds the batch. settled resolves with the final verdict. A superseded batch resolves with applied: 0 and no skipped entries.
ReasonMeaning
unknown-rowThe row id is not in data.
unknown-columnThe column id is not a known column.
holeThe id is the placeholder id of an unloaded scroll-mode row. A push by the real id of a row that is not loaded gets unknown-row.
readonlyA call with no source on a readOnly grid gets it. A call with another source gets it when the grid is readOnly, the column is read-only, or the row is read-only through readOnly(row). A "stream" call gets this reason for a column with no write path (accessorFn without setValue).
savingA stream call: the row has a save in flight. The grid holds the patch and applies it once the row's save settles. A later push to the same cell replaces it.
limitA stream call: the call carried more than 100,000 patches, and this patch came after them.
no-sourceThe call passed no source. The grid writes nothing. Pass { source: "stream" } or { source: "edit" }.
invalidThe column's validate rejected the value.
no-opThe value equals the current value.

Read the verdict

settled is set only while pending is true. This hook pushes patches, waits for an async schema, and returns the number of cells the call wrote:

"use client";

import { useCallback } from "react";
import {
  useDataGridActions,
  type CellPatch,
} from "@/components/data-grid/data-grid";

export function usePush() {
  const actions = useDataGridActions();

  return useCallback(
    async (patches: CellPatch[]) => {
      const verdict = actions.updateCells(patches, { source: "stream" });
      const final = (await verdict.settled) ?? verdict;
      for (const skip of final.skipped) {
        console.warn(`Patch ${skip.patchIndex} skipped: ${skip.reason}`);
      }
      return final.applied;
    },
    [actions],
  );
}

On this page