Skip to content

Commit 0e1631e

Browse files
committed
docs: add clarifying comments for table state management
- Add local-only state examples (commented) for both tasks and users tables - Clarify URL-synced state configuration with route schema defaults - Improve developer experience by documenting state management options
1 parent 155776c commit 0e1631e

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/features/tasks/components/tasks-table.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,12 @@ export function TasksTable({ data }: DataTableProps) {
3939
const [sorting, setSorting] = useState<SortingState>([])
4040
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
4141

42-
// Synced with URL states
42+
// Local state management for table (uncomment to use local-only state, not synced with URL)
43+
// const [globalFilter, onGlobalFilterChange] = useState('')
44+
// const [columnFilters, onColumnFiltersChange] = useState<ColumnFiltersState>([])
45+
// const [pagination, onPaginationChange] = useState<PaginationState>({ pageIndex: 0, pageSize: 10 })
46+
47+
// Synced with URL states (updated to match route search schema defaults)
4348
const {
4449
globalFilter,
4550
onGlobalFilterChange,

src/features/users/components/users-table.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,16 @@ type DataTableProps = {
4141
}
4242

4343
export function UsersTable({ data, search, navigate }: DataTableProps) {
44+
// Local UI-only states
4445
const [rowSelection, setRowSelection] = useState({})
4546
const [columnVisibility, setColumnVisibility] = useState<VisibilityState>({})
4647
const [sorting, setSorting] = useState<SortingState>([])
4748

49+
// Local state management for table (uncomment to use local-only state, not synced with URL)
50+
// const [columnFilters, onColumnFiltersChange] = useState<ColumnFiltersState>([])
51+
// const [pagination, onPaginationChange] = useState<PaginationState>({ pageIndex: 0, pageSize: 10 })
52+
53+
// Synced with URL states (keys/defaults mirror users route search schema)
4854
const {
4955
columnFilters,
5056
onColumnFiltersChange,

0 commit comments

Comments
 (0)