FormidableLabs / victory

A collection of composable React components for building interactive data visualizations
http://commerce.nearform.com/open-source/victory/
Other
11.03k stars 524 forks source link

Fix(#2941): hydration error using victory line on next js 15 #2973

Closed coston closed 1 week ago

coston commented 1 week ago

Description

🎯 ensure that uniqueId() is only called on mount to prevent hydration mismatch

Type of Change

How Has This Been Tested?

Manual testing with Next.js SSR and in the Victory demo app

Screenshots Before, the svg clip-path attribute value increments with every rerender. ![Kapture 2024-11-15 at 12 28 20](https://github.com/user-attachments/assets/5e64ca07-6371-42cc-aaf1-1f56ece98be8) After, the svg clip-path attribute value does not increment, because uniqueId is not recalled. ![Kapture 2024-11-15 at 12 22 09](https://github.com/user-attachments/assets/489c0da0-4099-4041-bae4-79e15a9ad104) Validated that user props still work fine image

Checklist: (Feel free to delete this section upon completion)

vercel[bot] commented 1 week ago

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

Name Status Preview Updated (UTC)
victory ✅ Ready (Inspect) Visit Preview Nov 15, 2024 9:08pm
github-actions[bot] commented 1 week ago
Folder/File Previous size New size Difference
/packages/victory/dist/victory.min.js 385.54KB 385.59KB +0.05KB (+0.01%)
TOTAL +0.05KB
changeset-bot[bot] commented 1 week ago

⚠️ No Changeset found

Latest commit: 074cd6354edf3c6860337cdfb6b2a6580de7aa4a

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR