Skip to content

Performance degradation in onPress #8086

Closed
@MrFlashAccount

Description

@MrFlashAccount

Provide a general summary of the issue here

After updating react-aria-components to the latest version (1.8.0) we faced a significant performance degradation, increasing passiveMountOnFiber duration from roughly 200ms to 1.8s(!)

After digging into the issue we found that the root cause is in usePress hook: https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/interactions/src/usePress.ts#L821 caused by: #8047

Here's a recording from chrome devtools:

Trace-20250412T155902.json

Here's a screenshot, you can see that usePress schedules over 2000 style recalculations.

Image

🤔 Expected Behavior?


😯 Current Behavior


💁 Possible Solution


🔦 Context


🖥️ Steps to Reproduce


Version

1.8.0

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

MacOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions