-
Notifications
You must be signed in to change notification settings - Fork 53
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
Adding Items doesn't work properly when using create-react-app #27
Comments
I'm still digging but it looks like the new Also, the same issue occurs if the |
I've been trying to come up with a way around the problem. My current idea is to keep track of the keys that have been actually been added and check the key of each child against that, but I don't have that working yet. |
Hi @Dianoga Thanks for the report, I will investigate thoroughly. Now I have tried to reproduce the problem on codesandox, using the create-react-app sandbox and using the grid demo code. The app seems to work, I noticed that the code was mistakenly changed. this <Item key={id} /> was changed to this <Item key={"id"} /> And obviously made the app break. Could you try to reproduce the problem by copying the grid demo code? |
I checked out your sandbox. One difference I saw from the normal ReactDom.render(<React.StrictMode><App /></React.StrictMode>, document.getElementById("root")); StrictMode isn't reporting any problems, but I'm wondering if the extra checks it does slows things down enough that it's exposing a race condition. From https://reactjs.org/docs/strict-mode.html
|
It is strange behavior, I will investigate further. I didn't understand if you managed to reproduce the bug with Strict mode. |
With StrictMode added to your sandbox the bug occurs. |
I am also having this problem. It's a create react app using typescript. React 17 generated the app, but I downgraded to React 16 which didn't solve the issue. EDIT: After applying #43, this fixed my issue. So I downgraded to React 16.13, and it worked even in Strict Mode. |
Fixed this with https://github.com/Secretmapper/muuri-react/tree/strict-muuri-0.9 - properly adding the old children using useEffect |
can you please explain i have the same issue here |
sandbox example does not exist :/ |
Minimal reproduction repo: https://github.com/Dianoga/muuri-react-cra-bug
There seems to be an issue in apps created using
create-react-app
.Specifically, when you add new items to the
MuuriComponent
they don't seem to get initialized properly.In the screenshot below you can see the first three items that were created on the first render of
MuuriComponent
. The second set of three items were added to the state and render, but don't get the muuri properties.Additionally, when navigating away from the page with the
MuuriComponent
and the broken items the below error shows up. That isn't demonstrated in the reproduction repo.Interestingly, when you build the project (using
npm run build
) it behaves correctly.I did a first pass at trying to figure out what was going on, but this is a complicated codebase and I pretty rapidly got lost.
The text was updated successfully, but these errors were encountered: