Portal is not ssr compat - accesses `document` during render
Description
When using InlineAutocomplete we inherit usage of <Portal /> rendering on page load.
I think the issue occurs because <Portal> calls document.createElement and createPortal with a ref to an element that can't be created.
https://github.com/primer/react/blob/500e529df47ae5def4bf5cedc55fc099251c25a1/src/Portal/Portal.tsx#L68
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 calls useLayoutEffect resulting in a call to console.error on the server - https://github.com/primer/react/blob/500e529df47ae5def4bf5cedc55fc099251c25a1/src/drafts/hooks/useCombobox.ts#L141-L157
Steps to reproduce
Atempt to SSR an app that uses InlineAutocomplete
Version
latest
Browser
No response
@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?
@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.