Skip to content

Fix Hydration Mismatch in OrbVisualizer Component (Closes #111)#117

Closed
vedhapprakashni wants to merge 3 commits intoNitya-003:mainfrom
vedhapprakashni:fix1
Closed

Fix Hydration Mismatch in OrbVisualizer Component (Closes #111)#117
vedhapprakashni wants to merge 3 commits intoNitya-003:mainfrom
vedhapprakashni:fix1

Conversation

@vedhapprakashni
Copy link
Contributor

Description
This PR fixes a critical hydration mismatch issue in the
OrbVisualizer
component caused by Math.random() calls during render.

Problem
The previous implementation used Math.random() directly in the render logic to generate particle positions and animation durations. This caused the server-rendered HTML to differ from the client-initial render, leading to Next.js hydration errors and broken animations.

Solution
Moved all random number generation into a useEffect hook to ensure it only runs on the client after mount.
Used state to store the generated random values.
Updated the component to render based on the state values.
Testing
Verify that the console no longer shows hydration mismatch warnings.
Confirm that the OrbVisualizer animation plays correctly after page load.

@vercel
Copy link

vercel bot commented Feb 16, 2026

@vedhapprakashni is attempting to deploy a commit to the Nitya Gosain's projects Team on Vercel.

A member of the Team first needs to authorize it.

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.

1 participant