Skip to content

[refactor] create Wrapper and TableCornerProvider to avoid rerenders#451

Merged
severo merged 5 commits intomasterfrom
simplify
Mar 3, 2026
Merged

[refactor] create Wrapper and TableCornerProvider to avoid rerenders#451
severo merged 5 commits intomasterfrom
simplify

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo severo commented Mar 3, 2026

see #449

Create a new Wrapper component for the outermost div element. Note that it provides the PortalContainerContext (a reference to it used for the portals).

Move the table corner (top left cell) size to a provider.

This avoids rerenders if that cell is resized, separates concerns, and removes the need to drill props.

@severo severo requested a review from Copilot March 3, 2026 13:20
@severo severo changed the title create Wrapper and TableCornerProvider to avoid rerenders [refactor] create Wrapper and TableCornerProvider to avoid rerenders Mar 3, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR follows issue #449 by splitting table-corner sizing concerns into dedicated contexts/providers and introducing a Wrapper component to host the portal container context, with the goal of reducing unnecessary re-renders and prop drilling in HighTable.

Changes:

  • Added TableCornerSizeProvider + TableCornerSizeContext to store and expose the top-left “table corner” cell width/height and its setter via context.
  • Updated TableCorner, Slice, ColumnWidthsProvider, and ScrollProvider to consume table-corner size via context rather than props/state lifted into HighTable.
  • Introduced components/HighTable/Wrapper to own the outer container element + PortalContainerContext provider.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/providers/ViewportSizeProvider.tsx Adds clarifying comment about clientWidth/clientHeight usage.
src/providers/TableCornerSizeProvider.tsx New provider that stores table-corner width/height and exposes a setter via contexts.
src/providers/ScrollProvider.tsx Replaces headerHeight prop with useHeaderHeight() from the new context.
src/providers/ColumnWidthsProvider.tsx Replaces tableCornerWidth prop with TableCornerWidthContext consumption.
src/contexts/TableCornerSizeContext.ts New contexts + hooks for table-corner width/height and setter.
src/components/TableCorner/TableCorner.tsx Switches to useSetTableCornerSize() and passes the element to the setter.
src/components/HighTable/Wrapper.tsx New outer wrapper that sets CSS vars and provides PortalContainerContext.
src/components/HighTable/Slice.tsx Removes setTableCornerSize prop drilling into TableCorner.
src/components/HighTable/HighTable.tsx Wires in TableCornerSizeProvider + Wrapper and removes local corner-size state.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/providers/TableCornerSizeProvider.tsx Outdated
Comment thread src/providers/TableCornerSizeProvider.tsx Outdated
Comment thread src/components/HighTable/Wrapper.tsx Outdated
severo and others added 4 commits March 3, 2026 09:28
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@severo severo merged commit 6596b07 into master Mar 3, 2026
5 checks passed
@severo severo deleted the simplify branch March 3, 2026 13:43
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.

2 participants