Skip to content

feat!: resize columns without re-rendering the sheet - #26

Merged
SyedSibtainRazvi merged 3 commits into
mainfrom
feat/resize-off-render
Nov 27, 2026
Merged

SyedSibtainRazvi merged 3 commits into
mainfrom
feat/resize-off-render

Conversation

@SyedSibtainRazvi

Copy link
Copy Markdown
Contributor

Etiquettes of raising a PR

PR reviews are a way to request peers to give feedback on the code that is going
to the mainline. This means, that PR should be in a reviewable state. Please ensure
that the following checkboxes are ticked. If any of them are not ticked, then
the PR is not ready for review

  • Did you test changes locally?
  • Did you check PR contents after opening the PR

Related issue

Functionalities added or changed

  • A drag re-renders only the resize handle, not the app's component or the rows:
    • useSheet passes useTable a selector that leaves out columnSizing and columnResizing.
    • Sheet writes --sheet-columns from table.atoms.columnSizing in a layout effect.
    • Each resize handle is a Subscribe island, so its width readout and highlight follow the drag. Keyboard resizing reads the width when the key is pressed.
    • The body's memo is gone, as the guide says.
  • Docs: README (what table.state leaves out, owning the widths with an atom, headless use, API reference), architecture.md and decisions.md.

Additional info

  • Breaking, so this goes out as 0.4.0. For an app:
    • table.state no longer has columnSizing or columnResizing. Read the widths with table.atoms.columnSizing.get(), or subscribe with Subscribe.
    • Resizing no longer re-renders the component that calls useSheet, so your own markup that reads getSize() while rendering has to subscribe.
    • An app that controls columnSizing with state and onColumnSizingChange still re-renders on every resize, and now its rows do too. TanStack recommends an external atom in atoms for owning the widths.
    • Gather doesn't read or control column widths.
  • Where this differs from TanStack's example (each explained in decisions.md):
    • The selector leaves out only the resize state, not everything (() => ({})), because a sheet re-renders for sorting, filters, pinning, visibility and order.
    • Sheet also sets --sheet-columns when it renders, so server-rendered HTML has its column tracks.
    • The layout effect depends on table, which useTable returns anew on each render, instead of [].
    • The handle uses the standalone Subscribe with table.store, which TanStack's React Compiler guide says to use in header components.
    • Rows don't get the example's content-visibility: auto, which isn't one of the guide's steps.
  • Docs checked on 23 Nov: the resizing, sizing, table-state and React Compiler guides, and the example, are unchanged since 9.3.1.
  • Tests:
    • 153 unit tests pass. New ones check that a drag re-renders neither the app nor the rows, that table.state has every slice but those two, and that widths and hidden columns the app controls still lay out. Three of them fail on main.
    • All 36 e2e tests pass, including a new mouse-drag test and both axe scans.
    • In a fresh Next 16 app with the packed package, the server HTML has the column tracks, and a drag in Chromium widens the header and the cells with a clean console. With an external atom for the widths, the drag didn't re-render the app.

Checklist

  • Tests
  • Translations
  • Documentation
  • Uploaded screenshots
  • Verified on preview url once

Screenshots

Page(s) if applicable

No visual change.

Follow TanStack v9's advice for resizing with columnResizeMode
'onChange'. useSheet's useTable selector leaves out the resize state,
Sheet writes --sheet-columns from table.atoms.columnSizing in a layout
effect, and only each resize handle subscribes to its column's width.
The body no longer needs its memo.

BREAKING CHANGE: table.state no longer holds columnSizing or
columnResizing, and resizing a column no longer re-renders the component
that calls useSheet. Read the widths with table.atoms.columnSizing.get(),
or subscribe with Subscribe. Code that reads a width while rendering,
such as column.getSize() in your own header or a --sheet-columns you
build yourself, has to subscribe to stay current. An app that controls
columnSizing through state and onColumnSizingChange still re-renders on
every resize, and now its rows do too: pass an external atom in atoms
instead, as TanStack's column sizing guide recommends.
@SyedSibtainRazvi SyedSibtainRazvi self-assigned this Nov 23, 2026
@SyedSibtainRazvi
SyedSibtainRazvi merged commit 1021205 into main Nov 27, 2026
1 check passed
@SyedSibtainRazvi
SyedSibtainRazvi deleted the feat/resize-off-render branch November 27, 2026 06:27
@SyedSibtainRazvi SyedSibtainRazvi mentioned this pull request Nov 27, 2026
4 of 7 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant