Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors internal state access to rely on direct useContext(...) reads (removing intermediate “useX” hooks) and moves some defaulting logic into providers/contexts to reduce rerenders and simplify memoization, aligning with issue #449.
Changes:
- Replace custom context hooks (
useViewportWidth,useHeaderHeight,useData, etc.) with directuseContext(Context)usage across providers/components/tests. - Introduce a default header/table-corner height via
defaultTableCornerHeightand initializeTableCornerSizeProviderwith that default. - Update provider tests to consume the raw contexts rather than removed hooks.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| test/providers/ViewportSizeProvider.test.tsx | Updates test to use raw viewport contexts via useContext. |
| test/providers/TableCornerSizeProvider.test.tsx | Updates test expectations for default header height and uses raw contexts. |
| test/providers/DataProvider.test.tsx | Replaces custom hooks with raw contexts for provider verification. |
| src/providers/TableCornerSizeProvider.tsx | Initializes table-corner height to a default and continues providing width/height/setter contexts. |
| src/providers/SelectionProvider.tsx | Switches from useData/useNumRows hooks to direct context reads. |
| src/providers/ScrollProvider.tsx | Uses ViewportHeightContext / TableCornerHeightContext / NumRowsContext directly. |
| src/providers/OrderByProvider.tsx | Uses ExclusiveSortContext directly. |
| src/providers/ColumnWidthsProvider.tsx | Uses ViewportWidthContext / TableCornerWidthContext / NumColumnsContext directly. |
| src/providers/ColumnParametersProvider.tsx | Uses ColumnDescriptorsContext directly. |
| src/providers/CellNavigationProvider.tsx | Uses NumRowsContext directly. |
| src/hooks/useFetchCells.ts | Uses DataContext / NumRowsContext directly for fetch computations. |
| src/contexts/ViewportSizeContext.ts | Removes wrapper hooks, leaving only contexts. |
| src/contexts/TableCornerSizeContext.ts | Adds defaultTableCornerHeight, makes height context non-optional, removes wrapper hooks. |
| src/contexts/DataContext.ts | Removes wrapper hooks (including useData), sets a non-throwing default DataContext value. |
| src/components/TableCorner/TableCorner.tsx | Reads SetTableCornerSizeContext directly. |
| src/components/HighTable/Wrapper.tsx | Reads NumRowsContext / TableCornerHeightContext directly. |
| src/components/HighTable/Slice.tsx | Reads DataContext / DataVersionContext / NumRowsContext directly. |
| src/components/HighTable/Scroller.tsx | Reads SetViewportSizeContext directly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 20 out of 20 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
see #449