fix(data-table): show skeleton on first load in virtualized tables#818
Conversation
The `isLoading && rows.length > 0` guard in `VirtualizedContent` suppressed the skeleton on initial load (when `rows.length === 0`), leaving consumers with an empty table body until data arrived. Drop the `rows.length > 0` half of the guard so the skeleton renders for both the first-load and pagination-refetch cases. Also remove the explicit `height: rowHeight` on loader rows so they size from intrinsic cell padding, matching the non-virtualized `DataTable.Content` loader. Same fix applied to `data-view-beta/VirtualizedContent`.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR refactors loader skeleton rendering in two virtualized data components. The Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add 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. Comment |
Summary
DataTable.VirtualizedContent(andDataViewbeta) was not rendering the skeleton loader on initial load. The guardrequired existing rows for the skeleton to render, which only ever fires on pagination/refetch — never on first load (
rows.length === 0). Consumers saw an empty table body under the headers until data arrived. The non-virtualizedDataTable.Contentdoes not have this gap.Drop
&& rows.length > 0so the skeleton renders for both first-load and refetch cases. Also remove the explicitheight: rowHeightfrom each loader row so it sizes from intrinsic cell padding — matching the height of the non-virtualizedLoaderRows. Same change applied todata-view-beta.Behavior matrix
Only the last row is a visible behavior change, and arguably an improvement (signals "we're fetching" instead of flashing blank).
Test plan
apps/www/examples/datatable-virtual, refresh — skeleton should appear on first loadDataTable.Content(non-virtualized) loader — should match