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
@mantine/core/Combobox memory leak #6127
Comments
Can you provide a complete reproduction repo? Then I'll give it a look. |
https://github.com/webdistortion/mantine-memory-leak ^ - pull that repo and run |
Thanks for the repo. For me it only disappears after commenting the following line in // require('@testing-library/jest-dom'); After this an empty test runs without error. However rendering a simple JSX element (without mantine) brings it back: import {cleanup, render} from '@testing-library/react';
describe('Welcome component', () => {
it('renders with no leaks', async () => {
const { container, debug, unmount } = render(<b />);
});
}); And this even seems to happen when if (false) {
const { container, debug, unmount } = render(<b />);
} So as with the above require simply including the library results in the leak detector being triggered. Is it the same for you? Overall for me there's no way to tell whether something from mantine really is leaking. I think a more appropriate test would be rerunning the same test a number of times and checking whether the memory consumption increases steadily. Also make sure to run I hope that helps a bit. |
This was absolutely not the case for me. What version of node are you on? I know there was memory leaks on early node versions with jest. Specifically I'm on 21 over here. I was able to isolate the behaviour specifically to the comboBox.Dropdown - removing this part in the JSX passes the test.
I'll do some further proof of concept work here if its required. |
I'm on the latest LTS on Windows - 20.12.2. |
Using Node 21 worked. Now I can dig deeper. :) Thanks for the hint! |
Hmm, it's really weird. Going deeper in For Going even deeper it's removing one of those lines that resolves it: And then it's into the depths of floating-ui where I haven't found anything yet. |
Dependencies check up
What version of @mantine/* packages do you have in package.json?
7.8.1
What package has an issue?
@mantine/core/Combobox
What framework do you use?
just plain ol' React
In which browsers you can reproduce the issue?
All
Describe the bug
When testing combobox with --detectLeaks using JEST, the test fails.
I have taken the unit test out of the repo directly, wrapped it in a mantineRender as per the documentation and ran a unit test with --detectLeaks - it appears that somewhere there is a leak within this component specifically.
Render Function
Unit test
Jest reports:
I tried utilising the
<Text>
component instead of just to make sure .. and it runs a test perfectly when calling --detectLeaksIf possible, include a link to a codesandbox with a minimal reproduction
No response
Possible fix
No response
Self-service
The text was updated successfully, but these errors were encountered: