Duplicates
Latest version
Steps to reproduce 馃暪
Cannot be reproduced in a CodeSandbox or StackBlitz, because the virtual browser does not display the error.
Steps:
- Create React App :
npx create-react-app masonry-app
- Install @mui/lab packages :
npm install @mui/lab @mui/material @emotion/react @emotion/styled
- Edit the file src/App.js with the following code
import "./App.css";
import { useState } from 'react';
import { Box } from "@mui/material";
import Masonry from "@mui/lab/Masonry";
import { LoadingButton } from '@mui/lab';
import Paper from "@mui/material/Paper";
import { styled } from "@mui/material/styles";
const Item = styled(Paper)(({ theme }) => ({
backgroundColor: theme.palette.mode === "dark" ? "#1A2027" : "#fff",
...theme.typography.body2,
padding: theme.spacing(0.5),
textAlign: "center",
color: theme.palette.text.secondary,
}));
function App() {
const [heights, setheights] = useState([150, 30, 90, 70, 110, 150, 130, 80, 50, 90, 100, 150, 30, 50, 80]);
const addItem = () => {
const updatedItems = [...heights];
updatedItems.push(300);
setheights(updatedItems);
};
return (
<>
<Masonry
columns={{ xs: 2, sm: 3, md: 4, lg: 5, xl: 6 }}
spacing={2}
>
{heights.map((height, index) => (
<Item key={index} sx={{ height }}>
{index + 1}
</Item>
))}
</Masonry>
<LoadingButton id="loadMore" size="large" variant="contained" onClick={addItem}>
Add Item
</LoadingButton>
</>
);
}
export default App;
- Run the app :
npm start
Current behavior 馃槸
When we refresh the page, we get message error Compiled with problems: ResizeObserver loop limit exceeded at http://127.0.0.1:3000/static/js/bundle.js
If I use this same code in a larger project, I have the same problem, but the error remains displayed.
Also, this happen with Chrome and Edge, not tested on others.
Expected behavior 馃
There should be no errors
Context 馃敠
Note: If I dynamically add an element in the Masonry, I get the error again. Apparently, this problem occurs when recalculating the width and height of the Masonry.
I noticed too, that if I put a 100% width on the objects returned by the Masonry, it is worse, it creates a loop with this error until memory saturation.
Unfortunately I don't have a solution to this problem :( @hbjORbj : Could you may have a look please ? I hope someone can help me.
Your environment 馃寧
npx @mui/envinfo
System:
OS: Linux 5.10 Debian GNU/Linux 11 (bullseye) 11 (bullseye)
Binaries:
Node: 16.19.1 - /usr/bin/node
Yarn: Not Found
npm: 8.19.3 - /usr/bin/npm
Browsers:
Chrome: Not Found
Firefox: Not Found
npmPackages:
@emotion/react: ^11.10.6 => 11.10.6
@emotion/styled: ^11.10.6 => 11.10.6
@mui/base: 5.0.0-alpha.125
@mui/core-downloads-tracker: 5.12.0
@mui/lab: ^5.0.0-alpha.126 => 5.0.0-alpha.126
@mui/material: ^5.12.0 => 5.12.0
@mui/private-theming: 5.12.0
@mui/styled-engine: 5.12.0
@mui/system: 5.12.0
@mui/types: 7.2.4
@mui/utils: 5.12.0
@types/react: 18.0.35
react: ^18.2.0 => 18.2.0
react-dom: ^18.2.0 => 18.2.0
typescript: 4.9.5
Duplicates
Latest version
Steps to reproduce 馃暪
Cannot be reproduced in a CodeSandbox or StackBlitz, because the virtual browser does not display the error.
Steps:
npx create-react-app masonry-appnpm install @mui/lab @mui/material @emotion/react @emotion/stylednpm startCurrent behavior 馃槸
When we refresh the page, we get message error
Compiled with problems: ResizeObserver loop limit exceeded at http://127.0.0.1:3000/static/js/bundle.jsIf I use this same code in a larger project, I have the same problem, but the error remains displayed.
Also, this happen with Chrome and Edge, not tested on others.
Expected behavior 馃
There should be no errors
Context 馃敠
Note: If I dynamically add an element in the Masonry, I get the error again. Apparently, this problem occurs when recalculating the width and height of the Masonry.
I noticed too, that if I put a 100% width on the objects returned by the Masonry, it is worse, it creates a loop with this error until memory saturation.
Unfortunately I don't have a solution to this problem :( @hbjORbj : Could you may have a look please ? I hope someone can help me.
Your environment 馃寧
npx @mui/envinfo