MinWidth config#238
Merged
philcunliffe merged 5 commits intomasterfrom Aug 6, 2025
Merged
Conversation
(cherry picked from commit 259d874be2bcdc2efb097da2397f800d0ff36adb)
severo
reviewed
Aug 5, 2025
Contributor
There was a problem hiding this comment.
Overall, I wonder: maybe we could create a context for the columns configuration, and its provider would be the outermost:
function HighTableData(props: PropsData) {
const { data, key, version } = useData()
const { numRows } = data
// TODO(SL): onError could be in a context, as we might want to use it everywhere
const { cacheKey, orderBy, onOrderByChange, selection, onSelectionChange, onError } = props
return (
<ColumnConfigurationProvider value={props.columnConfiguration}>
/* Create a new set of widths if the data has changed, but keep it if only the number of rows changed */
<ColumnStatesProvider key={cacheKey ?? key} localStorageKey={cacheKey ? `${cacheKey}${columnStatesSuffix}` : undefined} numColumns={data.header.length} minWidth={minWidth}>
{/* Create a new context if the dataframe changes, to flush the cache (ranks and indexes) */}
<OrderByProvider key={key} orderBy={orderBy} onOrderByChange={onOrderByChange} disabled={!data.sortable}>
{/* Create a new selection context if the dataframe has changed */}
<SelectionProvider key={key} selection={selection} onSelectionChange={onSelectionChange} data={data} onError={onError}>
{/* Create a new navigation context if the dataframe has changed, because the focused cell might not exist anymore */}
<CellsNavigationProvider key={key} colCount={data.header.length + 1} rowCount={numRows + 1} rowPadding={props.padding ?? defaultPadding}>
<PortalContainerProvider>
<HighTableInner version={version} {...props} />
</PortalContainerProvider>
</CellsNavigationProvider>
</SelectionProvider>
</OrderByProvider>
</ColumnStatesProvider>
</ColumnConfigurationProvider>
)
}and use that configuration inside the ColumnStates context, so that the rest of the code would not have to touch the minWidth parameter.
Alternatively, consume columnConfiguration as a prop of ColumnStatesProvider directly, which expands the scope of the context, but would be simpler, I guess
Otherwise, only some comments.
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.
Adds an optional minWidth to the column configuration