Skip to content

[refactor] remove intermediate Wrapper component#408

Merged
severo merged 15 commits intomasterfrom
refactor
Feb 3, 2026
Merged

[refactor] remove intermediate Wrapper component#408
severo merged 15 commits intomasterfrom
refactor

Conversation

@severo
Copy link
Copy Markdown
Contributor

@severo severo commented Feb 3, 2026

Remove Wrapper, by changing DataProvider to a hook (useData), and removing ErrorProvider.

Also:

  • fix a possible issue if onError calls useState (we cannot call onError during rendering)
  • rename 'key' to 'dataId' for clarity

@severo severo requested a review from Copilot February 3, 2026 00:40
@severo severo changed the title Refactor [refactor] remove intermediate Wrapper component Feb 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 refactors the component architecture by converting DataProvider from a React context provider to a custom hook (useData), removing the ErrorProvider and Wrapper components, and inlining the Wrapper logic directly into HighTable. The refactoring improves code organization by making data flow more explicit through props rather than implicit through context.

Changes:

  • Converted DataProvider to useData hook that returns dataId, version, and numRows
  • Removed ErrorProvider and ErrorContext, passing onError as explicit props to components that need it
  • Removed Wrapper component and merged its logic into HighTable component
  • Updated all affected providers to receive data, numRows, and onError as props instead of consuming them from context
  • Refactored RowsAndColumnsProvider to use useEffect pattern instead of state-based fetch management
  • Updated CellNavigationProvider to accept numRows and optional dataId props
  • Migrated tests from DataProvider.test.tsx to useData.test.ts with appropriate adjustments

Reviewed changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/hooks/useData.ts New hook that manages data frame state (dataId, version, numRows) by subscribing to data frame events
test/hooks/useData.test.ts New test file for useData hook, migrated from DataProvider tests
src/components/HighTable/HighTable.tsx Now includes the former Wrapper component logic and uses useData hook
src/components/HighTable/Slice.tsx Updated to receive data, numRows, and version as props
src/providers/CellNavigationProvider.tsx Updated to accept numRows and dataId as props instead of using DataContext
src/providers/SelectionProvider.tsx Updated to accept onError prop instead of using ErrorContext
src/providers/ScrollProvider.tsx Updated to accept numRows as prop
src/providers/RowsAndColumnsProvider.tsx Refactored to use useEffect for fetching, accepts data/numRows/onError as props, uses experimental useEffectEvent
test/providers/CellNavigationProvider.test.tsx Updated tests to pass numRows and dataId props directly
test/providers/DataProvider.test.tsx Deleted (tests migrated to useData.test.ts)
src/contexts/DataContext.ts Deleted (replaced by explicit prop passing)
src/contexts/ErrorContext.ts Deleted (replaced by explicit prop passing)
src/providers/ErrorProvider.tsx Deleted (onError now passed as prop)
src/components/HighTable/Wrapper.tsx Deleted (logic merged into HighTable.tsx)
Comments suppressed due to low confidence (1)

src/hooks/useData.ts:8

  • The JSDoc comment mentions "through the DataContext" but DataContext has been removed in this refactoring. The comment should be updated to reflect that this is now a hook that returns data frame state.

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

Comment thread src/providers/RowsAndColumnsProvider.tsx
Comment thread src/components/HighTable/HighTable.tsx
Comment thread test/providers/CellNavigationProvider.test.tsx
Comment thread src/components/HighTable/HighTable.tsx Outdated
Comment thread src/providers/SelectionProvider.tsx Outdated
Comment thread test/hooks/useData.test.ts Outdated
Comment thread test/hooks/useData.test.ts Outdated
severo and others added 5 commits February 2, 2026 20:46
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@severo severo merged commit 5e3ed3b into master Feb 3, 2026
5 checks passed
@severo severo deleted the refactor branch February 3, 2026 00:55
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