You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have verified that I use latest version of all @mantine/* packages
What version of @mantine/* packages do you have in package.json?
7.12.1
What package has an issue?
@mantine/core
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
All the components based on Popover (Combobox, Select, Tooltip) re-render too many times when their viewport position changes. As an example, try to profile the following code while scrolling on the ScrollArea:
The performance problem is not present if, for example, we use keepMounted = false or the Popover is disabled. See attached codesandbox for a comparison
If possible, include a link to a codesandbox with a minimal reproduction
As long as both refs are there, the effect will run the autoUpdate function. This explains why, when using keepMounted:false, the performance is fixed (because the floating ref is null). The fix is to only call autoUpdate if the floating is open
Self-service
I would be willing to implement a fix for this issue
The text was updated successfully, but these errors were encountered:
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.12.1
What package has an issue?
@mantine/core
What framework do you use?
Vite
In which browsers you can reproduce the issue?
All
Describe the bug
All the components based on Popover (Combobox, Select, Tooltip) re-render too many times when their viewport position changes. As an example, try to profile the following code while scrolling on the ScrollArea:
The performance problem is not present if, for example, we use
keepMounted = false
or the Popover is disabled. See attached codesandbox for a comparisonIf possible, include a link to a codesandbox with a minimal reproduction
https://codesandbox.io/p/sandbox/mantine-react-template-forked-rtgqx7
Possible fix
After looking at the implementation, I think that the main culprit is
mantine/packages/@mantine/core/src/components/Floating/use-floating-auto-update.ts
Line 19 in 00a94ce
As long as both refs are there, the effect will run the autoUpdate function. This explains why, when using
keepMounted:false
, the performance is fixed (because thefloating ref
isnull
). The fix is to only callautoUpdate
if the floating is openSelf-service
The text was updated successfully, but these errors were encountered: