Skip to content
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

fix: don't lockup in React strict mode when using DragDropManager #1554

Merged
merged 1 commit into from
Dec 4, 2024

Conversation

chrisvxd
Copy link

@chrisvxd chrisvxd commented Dec 4, 2024

Avoid passing the manager to the state initializer, as this causes issues with React strict mode. Instead, rely on the useEffect callback, already defined.

The manager arg passed back to the initializer function will now always be undefined, making it redundant.

It's still possible to cause strict mode to fail when using your own initalizer function to define a manager outside of dnd-kit, and pass it into the DragDropProvider.

Avoid passing the manager to the state initializer, as this causes issues with React strict mode. Instead, rely on the useEffect callback, already defined.

The \`manager\` arg passed back to the initializer function will now always be undefined, making it redundant.

It's still possible to cause strict mode to fail when using your own initalizer function to define a manager outside of dnd-kit, and pass it into the DragDropProvider.
chrisvxd added a commit to measuredco/puck that referenced this pull request Dec 4, 2024
chrisvxd added a commit to measuredco/puck that referenced this pull request Dec 4, 2024
@clauderic clauderic merged commit 103ab5a into clauderic:experimental Dec 4, 2024
@chrisvxd chrisvxd deleted the fix-react-strict-mode branch December 4, 2024 16:02
@github-actions github-actions bot mentioned this pull request Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants