Skip to content

Optimize Tabulator resize events#8528

Open
philippjfr wants to merge 2 commits intomainfrom
tabulator_resize_wait
Open

Optimize Tabulator resize events#8528
philippjfr wants to merge 2 commits intomainfrom
tabulator_resize_wait

Conversation

@philippjfr
Copy link
Copy Markdown
Member

@philippjfr philippjfr commented Mar 20, 2026

Tabulator resize events are expensive (100s of milliseconds) and even though we had debouncing implemented on them it turned out that after_layout didn't use the debounced version and the ResizeObserver fired very eagerly while a parent was rendering. A common example might be a Column containing some widgets and a Tabulator that stretches in height, the widgets might render after the Tabulator, which then causes a resize event to occur when the widgets render and take up space. Instead of resizing then we should wait until the parent (or rather the root) says all its children are idle, i.e. resizing is the last thing that should happen.

Here we await the root.ready Promise to ensure everything has settled before the trigger the resize. Additionally we measure the width and height and avoid resizing the table unless it has measurably changed.

@codecov
Copy link
Copy Markdown

codecov bot commented Mar 20, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.20%. Comparing base (dabdb38) to head (30ae743).

❗ There is a different number of reports uploaded between BASE (dabdb38) and HEAD (30ae743). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (dabdb38) HEAD (30ae743)
7 5
Additional details and impacted files
@@ Coverage Diff @@ ## main #8528 +/- ## =========================================== - Coverage 86.23% 70.20% -16.03%  =========================================== Files 349 348 -1 Lines 55388 55387 -1 =========================================== - Hits 47764 38887 -8877  - Misses 7624 16500 +8876 

☔ View full report in Codecov by Sentry.
📢 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.
continue
}
if (this._is_scrolling || this._initializing || this._building || this.container === null || this.is_drawing) {
await new Promise<void>((resolve) => setTimeout(resolve, 0))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

There's defer() in @bokehjs/core/util/defer for this purpose and also delay() for non-zero timeout.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants