-
Notifications
You must be signed in to change notification settings - Fork 578
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
Portal is not ssr compat - accesses document
during render
#3721
Comments
useLayoutEffect
which isn't ssr compatdocument
during render
@mattcosta7 thanks for filing and for putting up some PRs! Are you still looking into a solve, or would you like support? If the latter, can you also give us some info on whether this is blocking a particular product feature? |
I don't think I'll have time , but I don't believe it's blocking anything! |
Thanks, copy that. We'll move this to the backlog for now, but happy to reassess priority at any point as needed. |
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days. |
not stale |
Hi! This issue has been marked as stale because it has been open with no activity for 180 days. You can comment on the issue or remove the stale label to keep it open. If you do nothing, this issue will be closed in 7 days. |
Looks like I haven't done my usual "we should use popover instead" so: Rather than continuing to invest in portals we should be migrating the remaining cases to use popover instead. There is no good reason to use portals now that popover exists. |
Description
When using
InlineAutocomplete
we inherit usage of<Portal />
rendering on page load.I think the issue occurs because
<Portal>
callsdocument.createElement
andcreatePortal
with a ref to an element that can't be created.react/src/Portal/Portal.tsx
Line 68 in 500e529
we should avoid these apis in render in portal (which creates a div on every render) and rely on other mechanisms to sync it
In addition to this, it renders an _Autocomplette which uses
useCombobox
which callsuseLayoutEffect
resulting in a call toconsole.error
on the server -react/src/drafts/hooks/useCombobox.ts
Lines 141 to 157 in 500e529
Steps to reproduce
Atempt to SSR an app that uses
InlineAutocomplete
Version
latest
Browser
No response
The text was updated successfully, but these errors were encountered: