radix-ui / primitives

Radix Primitives is an open-source UI component library for building high-quality, accessible design systems and web apps. Maintained by @workos.
https://radix-ui.com/primitives
MIT License
14.87k stars 722 forks source link

Components (Dropdown, Dialog, etc) are too slow due to Passive effects. #2356

Closed hywook4 closed 4 months ago

hywook4 commented 10 months ago

Hi

When the page size is big (many DOMs), components such as Dropdown/Dialog becomes very slow.

I've used React profiler to dive deep into this issue and found that it's due to long Passive effects.

Below is the screenshot of the profiler result

Screen Shot 2023-08-22 at 5 16 07 PM

I've found that in the case of the Dropdown component, the issue was fixed when I gave modal={false} props.

Also seems like the "Presence" component is the main cause for the passive effects.

Thank you,

hywook4 commented 10 months ago

This is just a guess, but Presence key=".0" seems like the one causing the problem while I have no idea where it came from.

recurrence commented 6 months ago

Does anyone have a patch for this? Radix SCREAMS in comparison with modal false but it has other unintended consequences.

hariangr commented 6 months ago

Anyone have any lead on this?

tangye1234 commented 5 months ago

This issue basically is the biggest flaw in this project at present, and no one has come forward to resolve it yet.

taoliujun commented 4 months ago

When modal is enabled, popover calls the react-remove-scroll component, which iterates through every element in the page, and when there are enough elements, there are performance issues.

But I don't know how to solve it.

benoitgrelard commented 4 months ago

Let's concentrate on a single issue rather than have lots of duplicates for the same thing: #1634

ibanlopez commented 6 days ago

Let's concentrate on a single issue rather than have lots of duplicates for the same thing: #1634

How is the concentration going?