Skip to content

Removed unnecessary measureElement from virtual scroll#26959

Closed
rob-ghost wants to merge 1 commit intober-3470-fix-massive-member-countsfrom
fix/remove-measure-element
Closed

Removed unnecessary measureElement from virtual scroll#26959
rob-ghost wants to merge 1 commit intober-3470-fix-massive-member-countsfrom
fix/remove-measure-element

Conversation

@rob-ghost
Copy link
Copy Markdown
Contributor

Summary

  • Removes virtualizer.measureElement ref from virtual scroll item props since all consumers use fixed-height rows (estimateSize: () => 72 or default () => 100)
  • Dynamic measurement forces synchronous layout/reflow on every row mount, which is unnecessary for fixed-height rows
  • The virtualizer object is already returned from the hook, so any future consumer needing dynamic measurement can access virtualizer.measureElement directly

Built on top of #26952 which fixes the scroll container resolution.

Test plan

  • yarn workspace @tryghost/posts test:unit passes (114 tests)
  • Verified members table renders correctly with 1,000 members (19 visible rows, 738 total DOM elements)
  • Scrolling and infinite loading work correctly

The measureElement callback causes unnecessary re-measurements and
layout thrashing when rendering large virtualized lists
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 25, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

🗂️ Base branches to auto review (1)
  • 6.x

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 858a4f5f-d97f-4e27-b8f3-0dc2b44cc493

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/remove-measure-element

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.

@rob-ghost rob-ghost requested a review from jonatansberg March 25, 2026 15:52
@github-actions
Copy link
Copy Markdown
Contributor

E2E Tests Failed

To view the Playwright test report locally, run:

REPORT_DIR=$(mktemp -d) && gh run download 23550380401 -n playwright-report -D "$REPORT_DIR" && npx playwright show-report "$REPORT_DIR"

@rob-ghost
Copy link
Copy Markdown
Contributor Author

Closing this PR — the measureElement removal is unnecessary. The performance issue (3.4s blocking task) was caused by measuring 900+ items when the scroll container was misconfigured. PR #26952's overflow fix ensures only ~15 items render at a time, making measureElement negligible. Removing it actually breaks scroll position tracking for lists where estimateSize doesn't match actual row heights (e.g. tags: 77px actual vs 100px default estimate).

@rob-ghost rob-ghost closed this Mar 25, 2026
@rob-ghost rob-ghost deleted the fix/remove-measure-element branch March 25, 2026 21:52
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.

1 participant