Skip to content

Commit

Permalink
fix: remove forced synchronous layout in Drawer (#33665)
Browse files Browse the repository at this point in the history
  • Loading branch information
spmonahan authored Jan 22, 2025
1 parent 82ef8b9 commit d9e5810
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "patch",
"comment": "fix: remove forced synchronous layout in Drawer",
"packageName": "@fluentui/react-drawer",
"email": "[email protected]",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,15 +65,18 @@ export const useDrawerBody_unstable = (props: DrawerBodyProps, ref: React.Ref<HT
}, [cancelAnimationFrame, setAnimationFrame, updateScrollState]);

useIsomorphicLayoutEffect(() => {
updateScrollState();
cancelAnimationFrame();
setAnimationFrame(() => updateScrollState());
/* update scroll state when children changes */
}, [props.children, updateScrollState]);
return () => cancelAnimationFrame();
}, [props.children, cancelAnimationFrame, updateScrollState, setAnimationFrame]);

useIsomorphicLayoutEffect(() => {
updateScrollState();
cancelAnimationFrame();
setAnimationFrame(() => updateScrollState());

return () => cancelAnimationFrame();
}, [cancelAnimationFrame, updateScrollState]);
}, [cancelAnimationFrame, updateScrollState, setAnimationFrame]);

return {
components: {
Expand Down

0 comments on commit d9e5810

Please sign in to comment.