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: address prop name collision regression #857

Merged
merged 1 commit into from
Jan 29, 2025
Merged

Conversation

chrisvxd
Copy link
Member

Closes #679 regression.

The useResolvedFields hook was momentarily rendering the old fields with the new item ID. If the two items were of different types, but had matching prop names, the key used to render the field would clash and break the React lifecycle, which could result in hook changes between renders.

This was hard to test for, as the component has a useEffect that re-renders before the test can assert.

To fix, we store the ID of the fields alongside the resolvedFields, and only return the resolvedFields if the ID of the currently selected item matches.

Copy link

vercel bot commented Jan 29, 2025

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 Jan 29, 2025 1:09pm
puck-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 29, 2025 1:09pm

@chrisvxd chrisvxd merged commit 3a69ad4 into main Jan 29, 2025
4 checks passed
@chrisvxd chrisvxd deleted the 679-prop-name-collisions branch January 29, 2025 13:13
@chrisvxd chrisvxd mentioned this pull request Jan 29, 2025
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.

Prop name collisions
1 participant