[Bug]: useDrawerBody()
forces style recalculations
#33655
Labels
Component: Drawer
The Fluent v9 Drawer component
Fluent UI react-components (v9)
Status: In PR
Type: Bug 🐛
Component
Drawer
Package version
9.57.0
React version
18.3.1
Environment
Current Behavior
When children are updated
Drawer
forces a style recalculation.This seems to be because
getScrollState
reads values that force layout.Perhaps this is because there are two calls (1, 2) that will eventually call
getScrollState()
. Maybe they need to be in a rAF like theonScroll
call?I realize the 1.49ms might not sound like much but this also forces a layout calculation for another 1.73ms meaning we're doing 3.22ms of work that should be handled elsewhere. We're aiming for a 60fps refresh rate in an application (that is 16.67ms for all work in a frame, not just JS) and have observed forced style recalc + layout calc from
useDrawerBody
taking 5-10ms in some cases.Expected Behavior
Updates to
Drawer
should not force style recalculations.Reproduction
https://stackblitz.com/edit/tkwxyl8r?file=src%2Fexample.tsx
Steps to reproduce
Here's how to find the forced style recalc
Are you reporting an Accessibility issue?
no
Suggested severity
High - No workaround
Products/sites affected
No response
Are you willing to submit a PR to fix?
yes
Validations
The text was updated successfully, but these errors were encountered: