-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
React 18 (RC 0) StrictMode rendering breaks ability to find node by it's draggable id #2350
Comments
Same here, any plans to resolve this? |
You can follow the progress of this issue here: hello-pangea/dnd#317 |
any updates on this issue? |
Hit this issue today too. 'Fixed' by removing the <React.StrictMode> components round the rendering ofin my index.js. |
Beware guys that StrictMode also helps you with preparing your development builds for production. Make sure to check whether the issue is present in production too. |
atlassian/react-beautiful-dnd#2350 dnd doesn't support StrictMode now
atlassian/react-beautiful-dnd#2350 dnd doesn't support StrictMode now
atlassian/react-beautiful-dnd#2350 dnd doesn't support StrictMode now
Will it be fixed ? |
any fix yet? |
same problem here :/ |
same issue. Is there any fix for avoiding a way around like removing strict mode? |
same problem |
yup, same thing |
going through same issue. |
The workaround here works OK for me: #2399 (comment) |
If anyone is looking for a less hacky solution, I have a fork of this library @hello-pangea/dnd which natively supports react 18 and react strict mode. Just replace |
Is this going to be merged into react-beautiful-dnd eventually? |
same problem |
@Xhale1 I seems not to get it, replacing it means installing @hello-pangea/dnd](https://github.com/hello-pangea/dnd). won't it affect the functions? |
I do not think it will. Atlassian do not plan to put more effort on this library. At least in the foreseeable future. |
Ran into same problem |
It's been nearly a year, please fix this. |
This article is helpful to me. |
I can confirm that solution from @shunk76 comment is working |
I can confirm that the solution #2350 (comment) by 100terres is working.
This opening statement from the readme does not sound true as strict mode seems pretty critical to me for any serious production environment. |
Yes, this works. |
Awesome! It works! |
Atlassion has not fixed this issue in a year so we use the fork @hello-pangea/dnd atlassian/react-beautiful-dnd#2350
* refactor: extract data from Board component * feature: display board on opportunities page * test: add strict mode in storybook * chore: replace dnd to make it work with React 18 and strict mode Atlassion has not fixed this issue in a year so we use the fork @hello-pangea/dnd atlassian/react-beautiful-dnd#2350 * refactor: move mocked-data in a file * chore: use real column names in mock data * feature: design columns * feature: add New button at bottum of columns * bugfix: move header out of dragable so the cards does not flicker on drop * lint: remove useless imports * refactor: rename board item key
After some searching, I came across a very helpful snippet by GiovanniACamacho, which was converted to TypeScript by Meligy in that same issue, which resolved my problems and made me able to drag and drop again, with Strict Mode enabled.
|
I switched to https://github.com/hello-pangea/dnd and all issues were solved. |
Tks man you helped me |
Here is a typescript version for the |
* refactor: extract data from Board component * feature: display board on opportunities page * test: add strict mode in storybook * chore: replace dnd to make it work with React 18 and strict mode Atlassion has not fixed this issue in a year so we use the fork @hello-pangea/dnd atlassian/react-beautiful-dnd#2350 * refactor: move mocked-data in a file * chore: use real column names in mock data * feature: design columns * feature: add New button at bottum of columns * bugfix: move header out of dragable so the cards does not flicker on drop * lint: remove useless imports * refactor: rename board item key
https://github.com/hello-pangea/dnd is a fork that solves this stickmode problem The funniest thing is that the lib was working correctly and suddenly it stopped working, I'm using React 18.2.0, Next 14.0.2 |
|
I didn't have any more problems |
I also faced the same issue, as I tried to find out the difference between the code I wrote and the example code from the documentation, I found <React.StrictMode> is only when I commented out, that it works. |
Run into same problem |
Run into same problem with Next.js Set StrictMode to false and it's working + made rnd work only on client (works only after useEffect) |
Expected behavior
React Beautiful DnD should work as advertised on the latest React version with StrictMode enabled (which is a common default nowadays)
Actual behavior
Library fails to find draggable nodes with messaged logged (in development mode):
Unable to find draggable with id: card-2
When using the, now deprecated, ReactDOM.render API (instead of new ReactDOM.createRoot), React is forced to work in React 17 compatible manner, which eliminates the problem.
As I've found out, removing
<React.StrictMode />
wrapper resolved the issue, which means React Beautiful DnD is not compatible with Strict EffectsSteps to reproduce
yarn add react@rc react-dom@rc react-beautiful-dnd
,Suggested solution?
I am not familiar with innerworkings of the library, but I suspect the way registrations
registry.draggable
are handled makes StrictMode incompatible (I've only looked into it in debugger for like 10 seconds). I suspect other registrations also failWhat version of
React
are you using?18.0.0-rc0
What version of
react-beautiful-dnd
are you running?13.1.2
What browser are you using?
Safari 15.2 beta, Chrome 96
Demo
https://codesandbox.io/s/vertical-list-forked-hd8ve?file=/index.js
The text was updated successfully, but these errors were encountered: