React-beautiful-dnd: Error when updating state inside onDragStart

Created on 4 Jul 2018  ·  9Comments  ·  Source: atlassian/react-beautiful-dnd

I'm calling setState inside onDragStart and I'm getting the following error:

Error: Invariant failed: Attempting to move in an unsupported phase PREPARING

What version of React are you using?

16.3.2

What version of react-beautiful-dnd are you running?

8.0.1

What browser are you using?

Chrome

bug 🐞 investigating 🕵️‍♂️

All 9 comments

Can you please provide a stand alone example on codesandbox? Hard to know
what is causing your issue otherwise
On Thu, 5 Jul 2018 at 12:16 am, Nikola Telkedzhiev notifications@github.com
wrote:

I'm calling setState inside onDragStart and I'm getting the following
error:

Error: Invariant failed: Attempting to move in an unsupported phase
PREPARING
What version of React are you using?

16.3.2
What version of react-beautiful-dnd are you running?

8.0.1
What browser are you using?

Chrome


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/atlassian/react-beautiful-dnd/issues/617, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ACFN7Vmsy2iIyecpc0IGMxdz7niy8WAgks5uDM5AgaJpZM4VCqOc
.

Thank you! @alexreardon

All good for you now?

I now get an error when I try to update the state so that isDropDisabled is set to true (still inside onDragStart).

Error: Trying to set droppable isEnabled to true but it is already true.

Can you please post an independent example? I am keen to resolve this

I have a fix - PR incoming

Works fine now! Thanks once again.

You’re welcome! Thanks for the independent example. It made it easy to
action
On Wed, 11 Jul 2018 at 9:09 pm, Nikola Telkedzhiev notifications@github.com
wrote:

Works fine now! Thanks once again.


You are receiving this because you modified the open/close state.

Reply to this email directly, view it on GitHub
https://github.com/atlassian/react-beautiful-dnd/issues/617#issuecomment-404132252,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ACFN7RdGAChBtS77M97KlHQ8hv4Rx755ks5uFdzmgaJpZM4VCqOc
.

Was this page helpful?
0 / 5 - 0 ratings