Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After upgrading to v5.5.5, the Menu in AppHeader causes React to redraw frequently #2693

Closed
GZTimeWalker opened this issue Oct 12, 2022 · 12 comments
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)

Comments

@GZTimeWalker
Copy link

GZTimeWalker commented Oct 12, 2022

What package has an issue

@mantine/core

Describe the bug

After upgrade to v5.5.5, all the pages had 100% CPU usage, and the problem disappeared after the downgrade to v5.5.4

image

It seems to be caused by MenuItem and Box, in the last version these functions were no more than 10ms

image

image

截屏2022-10-13 01 28 39

What version of @mantine/hooks page do you have in package.json?

^5.5.5

If possible, please include a link to a codesandbox with the reproduced problem

Do you know how to fix the issue

No response

Are you willing to participate in fixing this issue and create a pull request with the fix

No response

Possible fix

No response

@GZTimeWalker GZTimeWalker changed the title High CPU and RAM Usage when upgrade to v5.5.5 After upgrading to v5.5.5, the Menu in AppHeader causes React to redraw frequently Oct 12, 2022
@rtivital
Copy link
Member

There were no changes to these components in 5.5.5 release. I also cannot reproduce any performance issues in the sandbox – https://codesandbox.io/s/dreamy-dijkstra-mche2z?file=/src/App.tsx
Most likely the issue is on your side.

@GZTimeWalker
Copy link
Author

Ok, I'm gonna find out what happened in the sandbox, catch you later.

@GZTimeWalker
Copy link
Author

There were no changes to these components in 5.5.5 release. I also cannot reproduce any performance issues in the sandbox – https://codesandbox.io/s/dreamy-dijkstra-mche2z?file=/src/App.tsx Most likely the issue is on your side.

Here you are.

@GZTimeWalker
Copy link
Author

It may be related to #2646 and #2690

@rtivital
Copy link
Member

@GZTimeWalker
Copy link
Author

@fdb75017
Copy link

fdb75017 commented Oct 13, 2022

Hello @rtivital , I'm having an issue that I think is linked here, see:
https://codesandbox.io/s/happy-dawn-84oqzm?file=/src/App.js

Not exactly trying to have a "controlled" menu, but rather just register when it is opened. It seems as soon as I attach the onOpen event, the Menu starts to behave strangely. When the button is clicked the first time, the onOpen callback gets fired but the Menu does not open. If I click a second time, then the menu opens. But it doesn't close if you click outside.

(happens since 5.5.5)

What do you think ? Maybe I'm misunderstanding the use of onOpen ?
Many thanks !

@rtivital
Copy link
Member

Okay, I'll check that, thanks for reporting

@rtivital rtivital reopened this Oct 13, 2022
@wes337
Copy link
Contributor

wes337 commented Oct 13, 2022

Hello @rtivital , I'm having an issue that I think is linked here, see: https://codesandbox.io/s/happy-dawn-84oqzm?file=/src/App.js

Not exactly trying to have a "controlled" menu, but rather just register when it is opened. It seems as soon as I attach the onOpen event, the Menu starts to behave strangely. When the button is clicked the first time, the onOpen callback gets fired but the Menu does not open. If I click a second time, then the menu opens. But it doesn't close if you click outside.

(happens since 5.5.5)

What do you think ? Maybe I'm misunderstanding the use of onOpen ? Many thanks !

Is this the issue in question here? Is this the original issue from @GZTimeWalker about redrawing and using 100% CPU resolved?

@fdb75017
Copy link

I believe it's the same issue yes, materializing differently. The original issue is resolved by switching the state control from the Menu onOpen to the button onClick as suggested by @rtivital (which also probably makes the onOpen prop a bit obsolete). Also same issue as in #2690, where the solution was to switch to a direct control through the button.

Thanks a lot !

@atumas-bananamilk
Copy link

atumas-bananamilk commented Oct 15, 2022

I face this issue when I add onChange to my Menu. Seems like the state becomes delayed by 1 step.
My version is way back but I still get the same issue as reported:
"@mantine/core": "^5.1.5"

@rtivital rtivital added the Fixed patch Completed issues that will be published with next patch (1.0.X) label Oct 18, 2022
@rtivital
Copy link
Member

The changes were reverted, should be fixed on 5.5.6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed patch Completed issues that will be published with next patch (1.0.X)
Projects
None yet
Development

No branches or pull requests

5 participants