feat: add automatic skeleton rows to Table - #4772
Merged
Merged
Conversation
gethinwebster
force-pushed
the
dev-v3-gethinw-table-auto-skeleton-rows
branch
from
July 23, 2026 07:22
5ba3e9e to
6978122
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4772 +/- ##
==========================================
+ Coverage 97.61% 97.63% +0.01%
==========================================
Files 952 957 +5
Lines 30816 31097 +281
Branches 11318 11435 +117
==========================================
+ Hits 30081 30361 +280
- Misses 688 689 +1
Partials 47 47 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
gethinwebster
temporarily deployed
to
allure-report
July 23, 2026 09:37 — with
GitHub Actions
Inactive
Comment on lines
+70
to
+72
| * - `totalRows` ('auto') - The number of skeleton rows is calculated from the available viewport height. | ||
| * - `maxAutoRows` (number) - Limits the number of rows rendered when `totalRows` is set to `'auto'`. | ||
| * - `minAutoRows` (number) - Sets the minimum number of rows rendered when `totalRows` is set to `'auto'`. |
NathanZlion
previously approved these changes
Jul 27, 2026
Comment on lines
+97
to
+121
| const minRowsValue = Math.max(1, minRows ?? 1); | ||
| const [rows, setRows] = useState(minRowsValue); | ||
| const rowHeightRef = useRef<number>(); | ||
|
|
||
| const updateRows = useCallback(() => { | ||
| if (!enabled) { | ||
| return; | ||
| } | ||
|
|
||
| const tableRoot = tableRootRef.current; | ||
| const tableWrapper = tableWrapperRef.current; | ||
| const skeletonRows = tableBodyRef.current?.querySelectorAll<HTMLElement>(SKELETON_ROW_SELECTOR); | ||
| const firstSkeletonRowRect = skeletonRows?.[0]?.getBoundingClientRect(); | ||
| const lastSkeletonRowRect = skeletonRows?.[skeletonRows.length - 1]?.getBoundingClientRect(); | ||
| const rowHeight = lastSkeletonRowRect?.height ?? rowHeightRef.current; | ||
|
|
||
| if (!tableRoot || !tableWrapper || !firstSkeletonRowRect || !lastSkeletonRowRect || !rowHeight) { | ||
| return; | ||
| } | ||
|
|
||
| rowHeightRef.current = rowHeight; | ||
| const nextRows = calculateAutoSkeletonRows({ | ||
| maxRows, | ||
| minRows: minRowsValue, | ||
| rowHeight, |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 13 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/table/use-auto-skeleton-rows.ts:57
getOverflowHeightpicks the first ancestor withoverflow-y: auto|scroll, even if it isn't actually overflowing. In layouts where an ancestor hasoverflow-y: autobut expands with content, this returns 0 and prevents the overflow-correction step from removing rows even when the document (or another ancestor) is overflowing.
function getOverflowHeight(element: HTMLElement) {
const scrollContainer = getScrollableParents(element)[0];
if (scrollContainer) {
return Math.max(0, scrollContainer.scrollHeight - scrollContainer.clientHeight);
}
NathanZlion
approved these changes
Jul 28, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to no response for status checks
Jul 28, 2026
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.
Adds automatic skeleton-row sizing to Table via
skeleton={{ totalRows: 'auto' }}: during loading the table fills its available viewport with placeholder rows, and a post-render correction removes rows if the rendered page would overflow (never below one row).Changes
use-auto-skeleton-rows.ts, wired throughTableinternals and interfaces.wrapLineson/off with long headers, and mixed data + skeleton rows (data rows always precede skeleton rows).#/light/app-layout/auto-skeleton-table,...-nowrap) with an external#hheader and#ffooter, matching a real console layout.Testing
npm run build,npm run lint, and the table unit suites (17/17) pass.