Skip to content

[scroll area] Perf improvements - #3536

Merged
atomiks merged 1 commit into
mui:masterfrom
atomiks:fix/scroll-area-perf
Dec 21, 2025
Merged

atomiks merged 1 commit into
mui:masterfrom
atomiks:fix/scroll-area-perf

Conversation

@atomiks

@atomiks atomiks commented Dec 13, 2025 •

Copy link
Copy Markdown
Contributor

Help with #3534 @oliviertassinari

The key issue causing the "flicker" from what I found is that the <Corner> element's size wasn't being taken into account during the first calculation of the thumb position. Once the corner has its size rendered, then the thumb calculation was correct. Since multiple calculations were happening on mount, this caused a visible flicker that was masked with a sync state update.

  • Prevented computeThumbPosition being called unnecessarily on mount (even though state updates were typically discarded) by blocking initial updates in observer callbacks and removing redundant effects
  • Made some variable names smaller for bundle size
  • Removed some memory allocations
  • Removed refs inserted into the context memo dep array unnecessarily

Also cleaned up the code a bit to remove duplication and grouped some hook calls more precisely

Preview: https://deploy-preview-3536--base-ui.netlify.app/react/components/select

@atomiks atomiks added performance component: scroll area Changes related to the scroll area component. labels Dec 13, 2025
@pkg-pr-new

pkg-pr-new Bot commented Dec 13, 2025 •

Copy link
Copy Markdown
  • vite-css-base-ui-example

    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/react@3536
    
    pnpm add https://pkg.pr.new/mui/base-ui/@base-ui/utils@3536
    

commit: 80df55a

@mui-bot

mui-bot commented Dec 13, 2025 •

Copy link
Copy Markdown

Bundle size report

Bundle Parsed size Gzip size
@base-ui/react ▼-188B(-0.05%) 🔺+60B(+0.05%)

Details of bundle changes


Check out the code infra dashboard for more information about this PR.

@netlify

netlify Bot commented Dec 13, 2025 •

Copy link
Copy Markdown

✅ Deploy Preview for base-ui ready!

Name Link
🔨 Latest commit 80df55a
🔍 Latest deploy log https://app.netlify.com/projects/base-ui/deploys/6948829159132c0008206833
😎 Deploy Preview https://deploy-preview-3536--base-ui.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@atomiks
atomiks force-pushed the fix/scroll-area-perf branch 4 times, most recently from a71dc2d to 33ec737 Compare December 13, 2025 20:51
@atomiks
atomiks marked this pull request as ready for review December 14, 2025 10:20
@atomiks
atomiks force-pushed the fix/scroll-area-perf branch from 33ec737 to 80df11f Compare December 14, 2025 20:32
@atomiks
atomiks force-pushed the fix/scroll-area-perf branch from 80df11f to 8a0fe5b Compare December 16, 2025 10:24

@LukasTy LukasTy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks and works nicely. 👍
Couldn't find issues, and Olivier's observed issue looks resolved. 👌

@atomiks
atomiks force-pushed the fix/scroll-area-perf branch 2 times, most recently from 19caede to c4d3cb7 Compare December 21, 2025 23:23
@atomiks
atomiks force-pushed the fix/scroll-area-perf branch from c4d3cb7 to 80df55a Compare December 21, 2025 23:28
@atomiks
atomiks merged commit de523ae into mui:master Dec 21, 2025
@atomiks
atomiks deleted the fix/scroll-area-perf branch December 21, 2025 23:32
@oliviertassinari oliviertassinari added the type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature. label Jan 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

component: scroll area Changes related to the scroll area component. performance type: enhancement It’s an improvement, but we can’t make up our mind whether it's a bug fix or a new feature.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants