mirror of
https://gitlab.com/mbugroup/lti-web-client.git
synced 2026-05-20 21:41:57 +00:00
chore: update server-side sorting pattern context
This commit is contained in:
@@ -192,12 +192,14 @@ Data tables use TanStack Table's `SortingState` wired to `useTableFilter` so tha
|
||||
|
||||
4. **SWR key** — SWR uses `getTableFilterToQueryString()` as its key, so any filter change (including sort) automatically re-fetches with the new query params. TanStack Table's built-in client sorting is effectively disabled; the server does the sorting.
|
||||
|
||||
**Pass `sorting` / `setSorting` to `<Table>`:**
|
||||
**Pass `sorting`, `setSorting`, and `manualSorting` to `<Table>`:**
|
||||
|
||||
```tsx
|
||||
<Table sorting={sorting} setSorting={setSorting} ... />
|
||||
<Table sorting={sorting} setSorting={handleSortingChange} manualSorting={true} ... />
|
||||
```
|
||||
|
||||
`manualSorting={true}` is required — without it TanStack Table still applies its own client-side sort pass on top of the server-sorted data, producing incorrect order.
|
||||
|
||||
**Reference implementation:** `MarketingTable` in [src/components/pages/marketing/MarketingTable.tsx](src/components/pages/marketing/MarketingTable.tsx).
|
||||
|
||||
## Server-side file export pattern
|
||||
|
||||
Reference in New Issue
Block a user