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

🐛 Do not attach document.body if SSR #3542

Merged
merged 1 commit into from
Jun 25, 2024

Conversation

magnh
Copy link
Contributor

@magnh magnh commented Jun 25, 2024

What does this pull request change?

This pull request improves support for SSR for Autocomplete by checking if typeof document === "undefined" before attaching document.body to floating-ui.

This should not change any existing functionality since the code is already checking that document is defined using ?. typeof can be used on the server.

Why is this pull request needed?

Get this error when our Next.js application tries to render an Autocomplete.

image

Did not manage to reproduce it in CodeSandbox, so it was just as fast creating a PR for it 😄

@magnh magnh self-assigned this Jun 25, 2024
@magnh magnh changed the title 🐛 Do not attatch document.body if SSR 🐛 Do not attach document.body if SSR Jun 25, 2024
@magnh magnh marked this pull request as ready for review June 25, 2024 08:56
Copy link
Collaborator

@oddvernes oddvernes left a comment

Choose a reason for hiding this comment

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

This is great, thanks for the help! I had mistakedly thought "?." would be enough

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