Skip to content

[UIK-5777][core] prevent calling redundat layout/rerender calls for useScrollBarWidth hook - #3147

Open
slizhevskyv-semrush wants to merge 2 commits into
release/v17from
UIK-5777/use-scrollbar-width-improvements
Open

[UIK-5777][core] prevent calling redundat layout/rerender calls for useScrollBarWidth hook#3147
slizhevskyv-semrush wants to merge 2 commits into
release/v17from
UIK-5777/use-scrollbar-width-improvements

Conversation

@slizhevskyv-semrush

Copy link
Copy Markdown
Contributor

Changelog

@semcore/core

Fixed

  • Performance regression for useScrollBarWidth hook.

Motivation and Context

The hook now uses a single module-level resize listener and cached measurement shared across all instances (via useSyncExternalStore) instead of running its own resize listener, forced layout read and setState on every mount. Eliminates N duplicate calculateScrollBar calls where N is the number of components using the hook (e.g. Tooltip). No API changes.

How has this been tested?

Manually

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).
  • Nice improve.

Checklist:

  • I have updated the documentation accordingly.
  • I have added new tests on added of fixed functionality.

Comment thread semcore/core/src/utils/use/useScrollBarWidth.ts Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants