Skip to content

Commit 811c282

Browse files
dmealingclaude
andcommitted
fix(tanstack): EntityGrid accepts id-less projection rows
Relax the row-type bound from { id?: number | string } to object. The grid keys rows by index (no getRowId) and never reads id, so the stricter bound needlessly failed TS's weak-type check against view-model rows that have a composite identity and no id column — which the codegen explicitly emits grids for. Backward-compatible: rows that do have id still satisfy object. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5e848b3 commit 811c282

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

client/web/packages/tanstack/src/entity-grid.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,12 @@ export interface EntityGridProps<T> {
5454
* Cell rendering routes through the CellRendererProvider registry, keyed by
5555
* `column.meta.view`. Per-column `cell` always wins if set.
5656
*/
57-
export function EntityGrid<T extends { id?: number | string }>(
57+
// Row type is any object: the grid keys rows by index (no getRowId), so it
58+
// never reads `id`. A stricter `{ id?: number | string }` bound wrongly rejected
59+
// id-less projection rows (view models with composite identity, e.g. a
60+
// my-courses view keyed by user+course), which the codegen explicitly generates
61+
// grids for.
62+
export function EntityGrid<T extends object>(
5863
props: EntityGridProps<T>,
5964
): ReactNode {
6065
const renderers = useCellRenderers();

0 commit comments

Comments
 (0)