Skip to content

feat: add automatic skeleton rows to Table - #4772

Merged
gethinwebster merged 11 commits into
mainfrom
dev-v3-gethinw-table-auto-skeleton-rows
Jul 28, 2026
Merged

feat: add automatic skeleton rows to Table#4772
gethinwebster merged 11 commits into
mainfrom
dev-v3-gethinw-table-auto-skeleton-rows

Conversation

@gethinwebster

@gethinwebster gethinwebster commented Jul 23, 2026

Copy link
Copy Markdown
Member

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

  • Automatic skeleton rows in use-auto-skeleton-rows.ts, wired through Table internals and interfaces.
  • Unit + browser integration coverage: sticky header, footer, wrapLines on/off with long headers, and mixed data + skeleton rows (data rows always precede skeleton rows).
  • AppLayout console-shell dev pages (#/light/app-layout/auto-skeleton-table, ...-nowrap) with an external #h header and #f footer, matching a real console layout.

Testing

  • npm run build, npm run lint, and the table unit suites (17/17) pass.
  • Browser integration tests run in CI.
  • Row-count oscillation risk was investigated with a real headless-Chrome probe (forced overflow, container churn, seed-height mismatch) — no oscillation and no ResizeObserver-loop warnings.

@gethinwebster gethinwebster changed the title Table: fix auto skeleton row overflow + layout coverage feat: add automatic skeleton rows to Table Jul 23, 2026
@gethinwebster
gethinwebster force-pushed the dev-v3-gethinw-table-auto-skeleton-rows branch from 5ba3e9e to 6978122 Compare July 23, 2026 07:22
@codecov

codecov Bot commented Jul 23, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.79518% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 97.63%. Comparing base (f97729a) to head (c8e171c).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/table/use-auto-skeleton-rows.ts 98.46% 1 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.

Comment thread src/table/use-auto-skeleton-rows.ts Outdated
Comment thread src/table/interfaces.tsx Outdated
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
NathanZlion previously approved these changes Jul 27, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

Comment thread src/table/use-auto-skeleton-rows.ts Outdated
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,

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • getOverflowHeight picks the first ancestor with overflow-y: auto|scroll, even if it isn't actually overflowing. In layouts where an ancestor has overflow-y: auto but 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);
  }

@gethinwebster
gethinwebster added this pull request to the merge queue Jul 28, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Jul 28, 2026
@gethinwebster
gethinwebster added this pull request to the merge queue Jul 28, 2026
Merged via the queue into main with commit 0c21452 Jul 28, 2026
94 of 95 checks passed
@gethinwebster
gethinwebster deleted the dev-v3-gethinw-table-auto-skeleton-rows branch July 28, 2026 12:36
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.

3 participants