Repository navigation
feat: accept column pinning in a server-mode data table's initial state - #129
Merged
Merged
Conversation
`ServerDataTableStoreParams` typed `initialState` as `never`, so a table paging and sorting server-side could pin nothing. Pinning is the only way to give a column a width of its own: `calculateColumnSizing` honours `size` on a pinned column and splits the remainder evenly between the rest. A server-mode table therefore had no way to let one column take the room its content needs, while a client-mode table does. Pinning is layout, not a view of the data, so it is the one piece of initial state that means the same thing in either mode. `columnFilters` and `sorting` stay client-only: in server mode those belong to the request. The store already read `initialState` regardless of mode and `reset()` deliberately never rebuilds it, so this is a type-level change alone. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
thomasbeaudry
added a commit
to DouglasNeuroInformatics/OpenDataCapture
that referenced
this pull request
Oct 30, 2026
`ServerDataTableStoreParams` types `initialState` as `never`, and `calculateColumnSizing` honours `columnDef.size` only on a pinned column, so a table that pages server-side could not give one column the room its content needs: every column took an identical share of the width. The patch is type-only -- the store already read `initialState` in both modes and `reset()` deliberately never rebuilds it. It carries DouglasNeuroInformatics/libui#129; delete it and the `patchedDependencies` entry when the catalog moves to the release that includes it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
joshunrau
approved these changes
Oct 30, 2026
|
🎉 This PR is included in version 6.19.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
thomasbeaudry
added a commit
to DouglasNeuroInformatics/OpenDataCapture
that referenced
this pull request
Oct 30, 2026
`ServerDataTableStoreParams` types `initialState` as `never`, and `calculateColumnSizing` honours `columnDef.size` only on a pinned column, so a table that pages server-side could not give one column the room its content needs: every column took an identical share of the width. The patch is type-only -- the store already read `initialState` in both modes and `reset()` deliberately never rebuilds it. It carries DouglasNeuroInformatics/libui#129; delete it and the `patchedDependencies` entry when the catalog moves to the release that includes it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
ServerDataTableStoreParamstypedinitialStateasnever, so aDataTablein server mode could pin nothing. Pinning is the only way to give a column a width of its own:calculateColumnSizinghonourscolumnDef.sizeon a pinned column and splits the remainder evenly between the unpinned ones. A server-mode table therefore had no way to let one column take the room its content needs — every column got an identical share — while a client-mode table does exactly that:Open Data Capture hit this on an activity log table that pages and sorts server-side: its repository column holds
owner/some-long-repository-nameand was stuck at one seventh of the table.Change
ServerDataTableInitialState = { columnPinning?: ColumnPinningState }, and server params accept it in place ofnever.ClientDataTableInitialStatenow composes from it, addingcolumnFiltersandsorting. Those stay client-only: in server mode filtering and sorting belong to the request, not to the table.getTanstackTableStatereads the initial state through the client shape, which the server one is a subset of, so the union's narrower member does not makecolumnFiltersandsortingunreadable there.This is a type-level change only.
getTanstackTableStatealready readinitialStateregardless of mode, andreset()deliberately never rebuilds it, so the runtime already behaved correctly — nothing but the type stopped a consumer from asking.Tests
Two cases in
DataTable.spec.tsxcovering a server-mode table with and without pinning, asserting against the sticky positioningDataTableHeadgives a pinned column. Verified red first: without this changetscrejects the spec withso the spec guards the type as well as the behaviour.
pnpm lintclean,vitest run src/components/DataTable8/8.🤖 Generated with Claude Code