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

EuiBreadcrumbs breaks SSR #3687

Closed
pugnascotia opened this issue Jul 2, 2020 · 3 comments · Fixed by #3970
Closed

EuiBreadcrumbs breaks SSR #3687

pugnascotia opened this issue Jul 2, 2020 · 3 comments · Fixed by #3970
Labels

Comments

@pugnascotia
Copy link
Contributor

EuiBreadcrumbs directly references window without any guards. I found this because I tried upgrading EUI in next-eui-starter, and rendering the index page broke.

Replicate in the starter repo with:

  • nvm use 14 (the next step upgrades a dependency that requires node >= 13.7)
  • yarn upgrade --latest
  • yarn dev
  • Visit http://localhost:3000
@pugnascotia pugnascotia added the bug label Jul 2, 2020
@IvanovRoman
Copy link

Solved for me:
import dynamic from 'next/dynamic';

const EuiHeaderBreadcrumbs = dynamic(
() => import('@elastic/eui').then(mod => mod.EuiHeaderBreadcrumbs),
{
ssr: false,
}
);

@mytototo
Copy link

It looks like EuiCollapsibleNav breaks SSR as well...

@thompsongl
Copy link
Contributor

At present, EUI doesn't have an official support strategy for SSR. We'd like to get to a place where we do, but it's not currently prioritized on the roadmap.

We'll fix (and happily accept PRs for) errors like these, but until there is a better testing framework in place for various app environments, they will likely continue to be one-off fixes.

pugnascotia added a commit to pugnascotia/eui that referenced this issue Aug 27, 2020
Closes elastic#3687. Put guards around references to `window` so that in an SSR
environment, EUI will still work.
pugnascotia added a commit to pugnascotia/eui that referenced this issue Aug 27, 2020
Closes elastic#3687. Put guards around references to `window` so that in an SSR
environment, EUI will still work.
pugnascotia added a commit that referenced this issue Sep 2, 2020
Closes #3687. Put guards around references to `window` in the breadcrumbs and collapsible nav
components, so that EUI can still render in an SSR environment.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants