-
Notifications
You must be signed in to change notification settings - Fork 0
Bug: DataTable Pagination Dropdown Synchronization Issue #61
Description
@etherisc/ui-kit Bug Report: DataTable Pagination Dropdown Synchronization Issue
Bug Report for: @etherisc/ui-kit v0.6.0
Submitted by: Web Application Team
Priority: High
Type: Bug
Problem Description
The DataTable component's pagination "rows per page" dropdown selector has a critical synchronization issue that prevents proper pagination control functionality.
Observed Behavior
- Default Display Issue: Table defaults to showing 10 rows, but dropdown indicator incorrectly stays at the first option in
pageSizeOptionsarray - Selection Not Working: When user selects 25 rows from dropdown, table correctly expands to show 25 rows
- Dropdown State Broken: Dropdown visual indicator remains at previous selection (e.g., shows "10" even when 25 rows are displayed)
- Cannot Return to Previous: User cannot switch back to 10 rows per page - selection appears broken
Expected Behavior
- Dropdown should visually reflect the current
pageSizestate - User should be able to freely switch between all
pageSizeOptionsvalues - Table display and dropdown indicator should stay synchronized at all times
Environment Details
- @etherisc/ui-kit: v0.6.0
- @tanstack/react-table: v8.21.3
- React: v19.1.0
- Project: Next.js web application with TanStack Table integration
Reproduction Steps
const paginationConfig = createSmartPaginationConfig(organizations.length, 'STANDARD');
<DataTable
data={organizations}
columns={columns}
enableSorting={true}
enableResizing={true}
pagination={paginationConfig.config}
loading={false}
/>Where paginationConfig.config equals:
{
pageSize: 10,
showSizeSelector: true,
showPageInfo: true,
showNavigation: true,
pageSizeOptions: [10, 25, 50, 100],
enableFastNavigation: false,
enableJumpToPage: false,
}Steps to reproduce:
- Load table with 20+ items (triggers pagination)
- Observe default shows 10 rows, dropdown shows first option
- Select "25" from dropdown
- ✅ Table correctly shows 25 rows
- ❌ Dropdown indicator still shows "10" or first option
- ❌ Cannot select "10" from dropdown to return to 10 rows
Technical Investigation
Current DataTable Interface Analysis
Based on our investigation of the ui-kit 0.6.0 DataTable component, the interface appears to support client-side pagination through:
interface DataTableProps<TData extends object> {
// Existing props
data: TData[];
columns: ColumnDef<TData>[];
// Pagination props (0.6.0)
pagination?: PaginationConfig | false;
// Missing: TanStack-compatible state management
// These may be missing or not properly implemented:
manualPagination?: boolean;
pageCount?: number;
rowCount?: number;
onPaginationChange?: (pagination: PaginationState) => void;
state?: { pagination?: PaginationState };
}Root Cause Hypothesis
The issue likely stems from one of these component design problems:
- Internal State Management: DataTable might not be properly managing internal pagination state for client-side pagination
- Missing TanStack Integration: Component may not be properly implementing TanStack Table's
state.paginationandonPaginationChangepattern - Dropdown State Sync: The pagination dropdown may not be correctly synchronized with the table's internal pagination state
Failed Workarounds
We attempted these fixes without success:
1. Default PageSize Alignment
// Changed default from 25 to 10 to match dropdown
const config = {
pageSize: 10, // ❌ Did not fix dropdown sync
pageSizeOptions: [10, 25, 50, 100]
};2. Manual State Management
// Attempted external state control
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
<DataTable
state={{ pagination }}
onPaginationChange={setPagination}
// ❌ Component doesn't accept these props in current interface
/>Expected Fix
The DataTable component should handle pagination state internally for client-side pagination scenarios, similar to how TanStack Table works out of the box:
// This should work automatically without external state management
<DataTable
data={data}
columns={columns}
pagination={{
pageSize: 10,
pageSizeOptions: [10, 25, 50, 100],
showSizeSelector: true
}}
/>Technical Requirements
Must Have
- Internal State Management: DataTable should manage
pageIndexandpageSizestate internally for client-side pagination - Dropdown Synchronization: Pagination dropdown must visually reflect current
pageSizestate - Bidirectional Updates: Changes to dropdown should update table, table state should update dropdown
- TanStack Compatibility: Should follow TanStack Table's pagination patterns
Should Have
- State Override Option: Allow external state management via
stateandonPaginationChangeprops for advanced use cases - Reset Capability: Provide way to reset pagination to initial state
- Validation: Ensure
pageSizeis always a valid option frompageSizeOptions
Impact Assessment
- Severity: High - Core pagination functionality is broken
- User Experience: Poor - Users cannot control table pagination properly
- Scope: All tables using client-side pagination with dropdown selector
- Developer Experience: Poor - Requires manual workarounds that shouldn't be necessary
Suggested Priority
High Priority - This represents a fundamental component behavior that developers expect to work out of the box. Manual state management for basic pagination defeats the purpose of having a reusable DataTable component.
Additional Context
Our team has successfully implemented comprehensive DataTable patterns using your ui-kit, including:
- Smart pagination configuration system
- Configurable pagination presets (SIMPLE/STANDARD/COMPLEX/HEAVY)
- Performance optimizations for different data complexity levels
This pagination dropdown bug is the last blocker preventing us from completing our DataTable modernization initiative.
Related Issues
- This may be related to broader client-side pagination state management in the DataTable component
- Could impact other pagination controls beyond just the dropdown selector
Contact: Web Application Team
Available for: Further testing, providing reproduction cases, or collaborating on the fix