-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Masonry] Check if container or child exists to prevent error #29452
Conversation
@@ -0,0 +1,6 @@ | |||
import * as React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is cheaper to do unit test. You can do something like
it('should not throw if children are empty', () => {
expect(() => render(<Masonry columns={3} spacing={1} />)).not.to.throw()
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always love your code review, Jun.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Nicee
Code sandboxes proving that this PR fixes
(2) the second issue: Uncaught Type Error is thrown when switching between pages |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check if the changes need to be applied in the other components that use the ResizeObserver
.
Please approve this 🥺 |
I'm still having this error in NextJS using the Link component, when I use just a simple ahref there are no problems. Unhandled Runtime Error Call Stack |
@brusacco Thanks for the report. Can you provide a codesandbox please? You can fork this template: https://codesandbox.io/s/mui-issue-latest-s2dsx |
Still happening on NextJS, i solved it by adding skeleton component: |
It doesn't look like this bug report has enough info for one of us to reproduce it. |
Closes #29362
Closes #29446
Problem:
Uncaught TypeError: Cannot read properties of null (reading 'clientWidth') at ResizeObserver.handleResize
Solution:
handleResize()
in order to preventCannot read properties of null
error.