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

refactor: zone setup #677

Merged
merged 1 commit into from
Nov 7, 2024
Merged

refactor: zone setup #677

merged 1 commit into from
Nov 7, 2024

Conversation

missilev
Copy link
Contributor

@missilev missilev commented Nov 5, 2024

Summary

This PR fixes a crash that occurs when using the Puck editor with Redux in a component that renders a DropZone. Currently, attempting this results in an error: [TypeError: can't define property x, objY is not extensible].

Root Cause

The issue stems from a mutation in Puck's setupZone utility, which modifies data.zones directly. This can lead to unexpected behavior and crashes in environments where immutability is expected, such as with Redux.

Solution

This PR introduces a simple refactor of prepareZone to prevent direct mutation of data.zones, ensuring compatibility with Redux and immutability principles.

Copy link

vercel bot commented Nov 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
puck-demo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 7, 2024 9:31am
puck-docs ✅ Ready (Inspect) Visit Preview Nov 7, 2024 9:31am

Copy link

vercel bot commented Nov 5, 2024

Someone is attempting to deploy a commit to the Measured Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Member

@chrisvxd chrisvxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good fix @missilev, thank you!

Prettier formatting is missing, causing linting to fail. Can you run npm run format and commit the diff?

@missilev
Copy link
Contributor Author

missilev commented Nov 6, 2024

@chrisvxd sure, fixed dba0af0

@chrisvxd chrisvxd merged commit 51154e9 into measuredco:main Nov 7, 2024
3 checks passed
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