-
Notifications
You must be signed in to change notification settings - Fork 842
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
[EuiPortal] convert to a function component, fix ssr bug #6055
[EuiPortal] convert to a function component, fix ssr bug #6055
Conversation
…ntent css class and usages
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
src/components/combo_box/combo_box_options_list/combo_box_options_list.tsx
Outdated
Show resolved
Hide resolved
src/components/bottom_bar/__snapshots__/bottom_bar.test.tsx.snap
Outdated
Show resolved
Hide resolved
This reverts commit c841fae.
…rtalRef; updated EuiBottomBar tests to account for new portal lifecycle
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
@constancecchen @thompsongl I've rolled back the sass/emotion changes so this is purely changing class -> function component. Applied the applicable suggestions, and I added a test for |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
@constancecchen |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice!!! Thanks for going above and beyond with the Cypress tests! Also digging the new data attribute for debugging (IMO, it'll be helpful even in the DOM/helping quickly scan for EUI portals).
Hopefully it won't generate a bunch of Kibana snapshot churn though hahaa nervous sweats
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
Digging into the EuiPopover cypress failure |
@chandlerprall Try merging/rebasing |
Cypress is happy after merging main; letting CI run again |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
Passes locally, maybe a race condition; jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
😕 a different test failed that time 😕 jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
The lifecycle change in the portal seems to have introduced an adverse race condition within the CI environment |
I say this because it doesn't make sense as to why the |
Co-authored-by: Greg Thompson <thompson.glowe@gmail.com>
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
The tour spec was failing as EuiWrappingPopover wasn't able to respond to the updated portal lifecycle. I've converted that component as well and now it's passing 🎆 |
const [anchor, setAnchor] = useState<HTMLElement | null>(null); | ||
const [portal, setPortal] = useState<HTMLElement | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should these be useRef
s instead of state, based on the usage? edit to clarify: Not a change request, just curious what the reasoning is for state
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They need to be state in order to kick-off a re-render after mount->setX calls, to trigger the useEffect. Assigning to a ref doesn't cause another pass.
Preview documentation changes for this PR: https://eui.elastic.co/pr_6055/ |
elastic#6105) * Revert "[EuiPortal] convert to a function component, fix ssr bug (elastic#6055)" This reverts commit 3aacaf9. * Re-revert / keep portal test changes * Restore `data-euiportal` attr for snapshot purposes * Restore SSR bugfix + add SSR tests * Changelog * Skip failing Cypress test that doesn't apply to class component
elastic#6105) * Revert "[EuiPortal] convert to a function component, fix ssr bug (elastic#6055)" This reverts commit 3aacaf9. * Re-revert / keep portal test changes * Restore `data-euiportal` attr for snapshot purposes * Restore SSR bugfix + add SSR tests * Changelog * Skip failing Cypress test that doesn't apply to class component
Summary
Closes #5656
Converted EuiPortal to a function component, whose lifecycle now enforces SSR support.
I also deleted theeuiBody-hasPortalContent
class name instead of converting it to emotion. Wasn't used by EuiPortal, and the two usages (tooltips, combo boxes) don't appear to be affected by it (tested in Chrome, Safari, Edge, FF). I also searched Kibana where there are 5 mentions in issues (most of them working around the class), but nothing in code.EuiBottomBar's tests had to be updated to use
mount
instead ofrender
as the portal div is no longer available o the first render passChecklist
- [ ] Checked in both light and dark modes- [ ] Props have proper autodocs and playground toggles- [ ] Added documentation- [ ] Checked Code Sandbox works for any docs examples- [ ] Updated the Figma library counterpart