From fd8b392ce6c157a29dcd104f992089a28752bf1f Mon Sep 17 00:00:00 2001 From: pasqualevitiello Date: Sun, 6 Sep 2026 10:38:32 +0200 Subject: [PATCH 1/3] feat: migrate TanStack Table to v9 --- .../members/members-page-client.tsx | 68 ++++++++++---- .../[id]/members/team-members-page-client.tsx | 33 +++++-- apps/examples/calcom/package.json | 2 +- apps/origin/package.json | 2 +- apps/origin/public/r/comp-477.json | 2 +- apps/origin/public/r/comp-478.json | 2 +- apps/origin/public/r/comp-479.json | 2 +- apps/origin/public/r/comp-480.json | 2 +- apps/origin/public/r/comp-481.json | 2 +- apps/origin/public/r/comp-482.json | 2 +- apps/origin/public/r/comp-483.json | 2 +- apps/origin/public/r/comp-484.json | 2 +- apps/origin/public/r/comp-485.json | 2 +- .../registry/default/components/comp-477.tsx | 17 +++- .../registry/default/components/comp-478.tsx | 75 +++++++++------ .../registry/default/components/comp-479.tsx | 33 +++++-- .../registry/default/components/comp-480.tsx | 91 ++++++++++++------- .../registry/default/components/comp-481.tsx | 42 +++++++-- .../registry/default/components/comp-482.tsx | 23 +++-- .../registry/default/components/comp-483.tsx | 49 +++++++--- .../registry/default/components/comp-484.tsx | 46 +++++++--- .../registry/default/components/comp-485.tsx | 76 +++++++++++----- apps/ui/package.json | 2 +- apps/ui/public/r/p-table-3.json | 2 +- apps/ui/public/r/p-table-4.json | 2 +- apps/ui/public/r/p-table-6.json | 2 +- apps/ui/public/r/p-table-8.json | 2 +- .../registry/default/particles/p-table-3.tsx | 18 ++-- .../registry/default/particles/p-table-4.tsx | 47 +++++++--- .../registry/default/particles/p-table-6.tsx | 18 ++-- .../registry/default/particles/p-table-8.tsx | 47 +++++++--- bun.lock | 18 ++-- 32 files changed, 500 insertions(+), 233 deletions(-) diff --git a/apps/examples/calcom/app/(dashboard)/members/members-page-client.tsx b/apps/examples/calcom/app/(dashboard)/members/members-page-client.tsx index 21d01890d..d84dbfece 100644 --- a/apps/examples/calcom/app/(dashboard)/members/members-page-client.tsx +++ b/apps/examples/calcom/app/(dashboard)/members/members-page-client.tsx @@ -42,11 +42,20 @@ import { type Column, type ColumnDef, type ColumnSizingState, + columnFilteringFeature, + columnPinningFeature, + columnResizingFeature, + columnSizingFeature, + columnVisibilityFeature, + createSortedRowModel, flexRender, - getCoreRowModel, - getSortedRowModel, + rowSelectionFeature, + rowSortingFeature, type SortingState, - useReactTable, + sortFn_alphanumeric, + sortFn_text, + tableFeatures, + useTable, } from "@tanstack/react-table"; import { ArrowUpRightIcon, @@ -127,6 +136,21 @@ type Member = { avatarUrl?: string; }; +const features = tableFeatures({ + columnFilteringFeature, + columnPinningFeature, + columnSizingFeature, + columnResizingFeature, + columnVisibilityFeature, + rowSelectionFeature, + rowSortingFeature, + sortedRowModel: createSortedRowModel(), + sortFns: { + alphanumeric: sortFn_alphanumeric, + text: sortFn_text, + }, +}); + const members: Member[] = [ { avatarUrl: @@ -352,25 +376,30 @@ function OptionalBadge({ value }: { value?: string }) { const FILLER_EXCLUDED_COLUMN_IDS = new Set(["select", "actions"]); const INITIAL_COLUMN_PINNING = { - left: ["select", "name"], - right: ["actions"], + end: ["actions"], + start: ["select", "name"], }; -function getPinningStyles(column: Column): CSSProperties { +function getPinningStyles( + column: Column, +): CSSProperties { const isPinned = column.getIsPinned(); return { - "--pinned-left-offset": - isPinned === "left" ? `${column.getStart("left")}px` : undefined, - left: undefined, - position: isPinned === "right" ? "sticky" : undefined, - right: isPinned === "right" ? `${column.getAfter("right")}px` : undefined, + "--pinned-start-offset": + isPinned === "start" ? `${column.getStart("start")}px` : undefined, + insetInlineEnd: + isPinned === "end" ? `${column.getAfter("end")}px` : undefined, + insetInlineStart: undefined, + position: isPinned === "end" ? "sticky" : undefined, zIndex: isPinned ? 1 : 0, } as CSSProperties; } -function getPinnedDataAttribute(column: Column): { - "data-pinned"?: "left" | "right"; +function getPinnedDataAttribute( + column: Column, +): { + "data-pinned"?: "end" | "start"; } { const isPinned = column.getIsPinned(); return isPinned ? { "data-pinned": isPinned } : {}; @@ -421,8 +450,8 @@ function getColumnDisplayWidth({ function getColumns( columnVisibility: Record, -): ColumnDef[] { - const cols: ColumnDef[] = [ +): ColumnDef[] { + const cols: ColumnDef[] = [ { cell: ({ row }) => (