Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions frontend/eslint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ export default tseslint.config(
paths: [
{
name: '@tanstack/react-table',
importNames: ['useReactTable'],
importNames: ['useTable'],
message:
'Call useTableState from @/components/data-table/useTableState instead. It wraps useReactTable so getRowId cannot fall back to TanStack’s index default (#307, #359).',
'Call useTableState from @/components/data-table/useTableState instead. It wraps useTable so getRowId cannot fall back to TanStack’s index default (#307, #359).',
},
],
},
Expand All @@ -59,10 +59,6 @@ export default tseslint.config(
files: ['src/components/data-table/useTableState.ts'],
rules: {
'no-restricted-imports': 'off',
// React Compiler flags useReactTable as an incompatible library. This
// disable used to be repo-wide because the call sites were scattered;
// confining them to one file is what lets it narrow to one file.
'react-hooks/incompatible-library': 'off',
},
},
{
Expand Down
55 changes: 43 additions & 12 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@radix-ui/react-slot": "^1.3.3",
"@shadcn/react": "^0.2.1",
"@tanstack/react-query": "^5.101.4",
"@tanstack/react-table": "^8.21.3",
"@tanstack/react-table": "^9.0.0",
"@tanstack/react-virtual": "^3.13.23",
"ai": "^7.0.31",
"class-variance-authority": "^0.7.1",
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/data-table/DataTable.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { Fragment, type ReactNode } from "react";
import {
flexRender,
type Row,
type Table as TanstackTable,
} from "@tanstack/react-table";
import { flexRender, type RowData } from "@tanstack/react-table";
import type {
ComicarrRow,
ComicarrTable,
} from "@/components/data-table/useTableState";
import {
Table,
TableBody,
Expand All @@ -14,14 +14,14 @@ import {
} from "@/components/ui/table";
import { cn } from "@/lib/utils";

interface DataTableProps<TData> {
table: TanstackTable<TData>;
interface DataTableProps<TData extends RowData> {
table: ComicarrTable<TData>;
onRowClick?: (row: TData) => void;
renderSubRow?: (row: Row<TData>, colSpan: number) => ReactNode;
renderSubRow?: (row: ComicarrRow<TData>, colSpan: number) => ReactNode;
className?: string;
}

export function DataTable<TData>({
export function DataTable<TData extends RowData>({
table,
onRowClick,
renderSubRow,
Expand Down
18 changes: 11 additions & 7 deletions frontend/src/components/data-table/DataTableSortHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,19 @@
import type { Column } from "@tanstack/react-table";
import type { CellData, Column, RowData } from "@tanstack/react-table";
import { ChevronUp, ChevronDown, ChevronsUpDown } from "lucide-react";
import type { ComicarrTableFeatures } from "@/components/data-table/useTableState";

interface DataTableSortHeaderProps<TData> {
column: Column<TData>;
interface DataTableSortHeaderProps<
TData extends RowData,
TValue extends CellData,
> {
column: Column<ComicarrTableFeatures, TData, TValue>;
title: string;
}

export function DataTableSortHeader<TData>({
column,
title,
}: DataTableSortHeaderProps<TData>) {
export function DataTableSortHeader<
TData extends RowData,
TValue extends CellData,
>({ column, title }: DataTableSortHeaderProps<TData, TValue>) {
if (!column.getCanSort()) {
return <span>{title}</span>;
}
Expand Down
Loading
Loading