Skip to content

Conversation

@joshunrau
Copy link
Collaborator

@joshunrau joshunrau commented Jan 8, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Enhanced DataTable with customizable search handlers and toggle components for flexible filtering and display options.
    • Improved row action handling and empty state customization.
  • Refactor

    • DataTable architecture redesigned with store-based state management for improved performance and maintainability.
    • Reorganized DataTable components for better modularity and reusability.
  • Tests

    • Added comprehensive DataTable test coverage.
  • Chores

    • Added @tanstack/table-core dependency; removed test mocking utilities.

✏️ Tip: You can customize this high-level summary in your review settings.

@joshunrau joshunrau merged commit db58c9f into main Jan 8, 2026
1 of 2 checks passed
@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

The DataTable component undergoes architectural refactoring from an inline React Table implementation to a store-based, context-driven design. Zustand store management centralizes table state; modular sub-components handle head, body, controls, pagination, and empty states. Test infrastructure updates remove global zustand mocking. DestructiveActionDialog and RowActionsDropdown components are removed.

Changes

Cohort / File(s) Summary
Removed/Deleted
__mocks__/zustand.ts, src/components/DataTable/DestructiveActionDialog.tsx, src/components/DataTable/RowActionsDropdown.tsx
Eliminated zustand mock file and row action dialog/dropdown components; consolidates destructive action and row action handling into new patterns.
Store & State Management
src/components/DataTable/store.ts, src/components/DataTable/context.ts, src/components/DataTable/constants.ts
Introduces Zustand store (createDataTableStore) with memoized handles, React context provider for store distribution, and symbol-based constants for metadata and memoization keys.
Core Components
src/components/DataTable/DataTable.tsx, src/components/DataTable/DataTableContent.tsx
Refactors DataTable to initialize store and provide context; DataTableContent orchestrates table layout and delegates rendering to sub-components.
Table Sub-Components
src/components/DataTable/DataTableHead.tsx, src/components/DataTable/DataTableBody.tsx, src/components/DataTable/DataTablePagination.tsx, src/components/DataTable/DataTableControls.tsx
New modular components handle header rendering, body rows, pagination controls, and search/filter UI; read state from store via hooks.
Utility Components
src/components/DataTable/DataTableEmptyState.tsx, src/components/DataTable/DataTableRowActionCell.tsx
Standalone empty state display and row action cell rendering for dropdown actions.
Types & Utilities
src/components/DataTable/types.ts, src/components/DataTable/utils.tsx, src/components/DataTable/hooks.ts
Comprehensive type augmentation for TanStack Table Core; helpers for column sizing, memoization, rendering; custom hooks for store access and container sizing.
Stories & Tests
src/components/DataTable/DataTable.stories.tsx, src/components/DataTable/__tests__/DataTable.spec.tsx
Expands story coverage with Payment model, custom filters, toggles, and grouped layouts; adds unit tests for rendering and search functionality.
Configuration & Setup
package.json, src/testing/setup-tests.ts, src/hooks/useDestructiveAction/useDestructiveActionStore.test.ts, src/hooks/useNotificationsStore/useNotificationsStore.test.ts
Adds @tanstack/table-core dependency, exports package.json entry, removes global zustand mock from test setup, and updates test teardown patterns.

Sequence Diagram

sequenceDiagram
    participant App as Application
    participant DT as DataTable
    participant Store as DataTableStore<br/>(Zustand)
    participant Ctx as DataTableContext
    participant Controls as DataTableControls
    participant Head as DataTableHead
    participant Body as DataTableBody
    participant Hooks as Custom Hooks
    
    App->>DT: Render with props
    DT->>Store: createDataTableStore(params)
    DT->>Ctx: Provide store context
    
    Ctx->>Controls: Render (with context)
    Ctx->>Head: Render (with context)
    Ctx->>Body: Render (with context)
    
    Controls->>Hooks: useDataTableStore()
    Hooks->>Store: Read globalFilter, setGlobalFilter
    Controls->>Controls: Render SearchBar + Toggles
    
    Head->>Hooks: useDataTableHandle('headerGroups')
    Hooks->>Store: Access memoized headerGroups
    Head->>Head: Render headers with sticky pins
    
    Body->>Hooks: useDataTableHandle('rows')
    Hooks->>Store: Access memoized rows
    Body->>Body: Render rows with cells
    
    Controls->>Store: Update global filter on search
    Store->>Store: Invalidate memoized handles
    Hooks-->>Head: Re-derive headerGroups
    Hooks-->>Body: Re-derive rows
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🎯 The table transforms with grace,
From monolith to modular place,
Store and hooks dance in the light,
Context binds components tight,
Zustand mocks fade from sight! 📊

✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6f88420 and 876342a.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (23)
  • __mocks__/zustand.ts
  • package.json
  • src/components/DataTable/DataTable.stories.tsx
  • src/components/DataTable/DataTable.tsx
  • src/components/DataTable/DataTableBody.tsx
  • src/components/DataTable/DataTableContent.tsx
  • src/components/DataTable/DataTableControls.tsx
  • src/components/DataTable/DataTableEmptyState.tsx
  • src/components/DataTable/DataTableHead.tsx
  • src/components/DataTable/DataTablePagination.tsx
  • src/components/DataTable/DataTableRowActionCell.tsx
  • src/components/DataTable/DestructiveActionDialog.tsx
  • src/components/DataTable/RowActionsDropdown.tsx
  • src/components/DataTable/__tests__/DataTable.spec.tsx
  • src/components/DataTable/constants.ts
  • src/components/DataTable/context.ts
  • src/components/DataTable/hooks.ts
  • src/components/DataTable/store.ts
  • src/components/DataTable/types.ts
  • src/components/DataTable/utils.tsx
  • src/hooks/useDestructiveAction/useDestructiveActionStore.test.ts
  • src/hooks/useNotificationsStore/useNotificationsStore.test.ts
  • src/testing/setup-tests.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link

github-actions bot commented Jan 8, 2026

🎉 This PR is included in version 5.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants