From a616723d366097875739c85652bc925be4c4cc34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Burak=20Boduro=C4=9Flu?= <80620802+burakboduroglu@users.noreply.github.com> Date: Tue, 4 Aug 2026 14:22:15 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=F0=9F=A7=B1=20render=20a=20display=20co?= =?UTF-8?q?lumn's=20own=20cell=20instead=20of=20the=20empty=20dash=20-=20D?= =?UTF-8?q?ataTable=20replaced=20a=20cell=20with=20"-"=20whenever=20cell.g?= =?UTF-8?q?etValue()=20was=20empty,=20=20=20without=20ever=20calling=20the?= =?UTF-8?q?=20column's=20own=20render=20function.=20A=20display=20column?= =?UTF-8?q?=20=20=20(no=20accessorFn/accessorKey)=20has=20no=20value=20to?= =?UTF-8?q?=20be=20empty=20=E2=80=94=20getValue()=20is=20=20=20always=20un?= =?UTF-8?q?defined=20=E2=80=94=20so=20every=20column=20that=20draws=20itse?= =?UTF-8?q?lf=20from=20row.original=20=20=20silently=20rendered=20a=20dash?= =?UTF-8?q?=20-=20the=20payments=20student=20roster=20showed=20"-"=20on=20?= =?UTF-8?q?every=20row=20while=20the=20backend=20=20=20was=20returning=20f?= =?UTF-8?q?ull=20display=20names=20-=20the=20empty-cell=20fallback=20now?= =?UTF-8?q?=20applies=20only=20to=20columns=20that=20actually=20carry=20?= =?UTF-8?q?=20=20a=20value;=20the=20"actions"/"update"/"select"=20id=20all?= =?UTF-8?q?owlist=20stays=20as=20a=20second=20=20=20guard?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/ui/data-table.test.tsx | 18 ++++++++++++++++++ src/components/ui/data-table.tsx | 8 +++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/components/ui/data-table.test.tsx b/src/components/ui/data-table.test.tsx index b34fc08..652d733 100644 --- a/src/components/ui/data-table.test.tsx +++ b/src/components/ui/data-table.test.tsx @@ -101,3 +101,21 @@ test("shows the pagination footer on a single page", () => { expect((screen.getByRole("button", { name: "Previous" }) as HTMLButtonElement).disabled).toBe(true); expect((screen.getByRole("button", { name: "Next" }) as HTMLButtonElement).disabled).toBe(true); }); + +test("a display column renders its own cell instead of the empty dash", () => { + // A column with no accessorFn has no value to be empty, so the empty-cell + // fallback must not swallow its render function. + render(() => ( + + `#${c.row.original.name}` }, + ] as ColumnDef[]} + data={[{ name: "ada" }]} + /> + + )); + + expect(screen.getByText("#ada")).toBeTruthy(); +}); diff --git a/src/components/ui/data-table.tsx b/src/components/ui/data-table.tsx index e3ea3ff..e56559f 100644 --- a/src/components/ui/data-table.tsx +++ b/src/components/ui/data-table.tsx @@ -355,7 +355,13 @@ export function DataTable(props: DataTableProps