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

(frontend)[AGE-1464]: implement useIsomorphicLayoutEffect hook to prevent using useLayoutEffect on server #2362

Conversation

ardaerzin
Copy link
Contributor

closes AGE-1464

What has changed

  • introduced a useIsomorphicLayoutEffect hook
// useIsomorphicLayoutEffect is a custom hook that uses useLayoutEffect on the client-side
// (when window is defined) and useEffect on the server-side (when window is undefined).
// This ensures that the code runs correctly in both client-side and server-side environments.

I guess the only test is to check that this warning is not getting logged to terminal

Copy link

vercel bot commented Dec 10, 2024

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

Name Status Preview Comments Updated (UTC)
agenta ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 10:27pm
agenta-documentation ✅ Ready (Inspect) Visit Preview 💬 Add feedback Dec 10, 2024 10:27pm

@ardaerzin ardaerzin marked this pull request as ready for review December 11, 2024 10:41
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. Frontend typescript labels Dec 11, 2024
@mmabrouk mmabrouk changed the base branch from main to dev December 11, 2024 12:01
Copy link
Member

@bekossy bekossy left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Dec 11, 2024
Copy link
Member

@mmabrouk mmabrouk left a comment

Choose a reason for hiding this comment

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

Thanks for this. The warning is pretty annoying!

@mmabrouk mmabrouk merged commit 3483f08 into dev Dec 11, 2024
9 checks passed
@mmabrouk mmabrouk deleted the AGE-1464/implement-useIsomorphicLayoutEffect-to-prevent-using-useLayoutEffect-on-server branch December 11, 2024 14:12
@ardaerzin
Copy link
Contributor Author

Thanks for this. The warning is pretty annoying!

I know, right :) cleaning these will help us see actual issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Frontend lgtm This PR has been approved by a maintainer size:S This PR changes 10-29 lines, ignoring generated files. typescript
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants