Skip to content
Discussion options

You must be logged in to vote

The cause is that the example only writes CSS variables for table.getFlatHeaders(), and that list only includes visible columns. A column that starts hidden never gets a --col-<id>-size / --header-<id>-size variable. Showing it doesn't change columnSizing, so the writer never runs again. The new cells then render with calc(var(--col-b-size) * 1px), which is invalid because the variable doesn't exist, so the width falls back to auto.

The fix is to re-run the writer when visibility changes as well as when sizing changes.

v9 (current example, atoms):

React.useLayoutEffect(() => {
  const writeColumnSizeVars = () => {
    const tableEl = tableRef.current
    if (!tableEl) return
    for (const …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@phb-ig
Comment options

Answer selected by phb-ig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants