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

fix(packages): check canUseDOM before using DOM #5733

Merged
merged 2 commits into from
May 5, 2021

Conversation

redallen
Copy link
Contributor

@redallen redallen commented May 3, 2021

What: Closes #5732

Additional issues:

@patternfly-build
Copy link
Contributor

patternfly-build commented May 3, 2021

@kmcfaul
Copy link
Contributor

kmcfaul commented May 4, 2021

If canUseDOM returns false, wouldn't that make the page broken (no event listeners) without any warnings? Or is canUseDOM expected to be true most of the time?

@redallen
Copy link
Contributor Author

redallen commented May 4, 2021

@kmcfaul If canUseDOM is false the page is non-interactive. canUseDOM just checks that window exists and that React can work via createElement.

If canUseDOM is false you're probably using SSR to render components in a fake DOM using a node context. In that case you don't care about event listeners and just want an initial rendering to later hydrate.

@kmcfaul
Copy link
Contributor

kmcfaul commented May 4, 2021

Ah I see, thanks for clarifying!

kmcfaul
kmcfaul previously approved these changes May 4, 2021
Copy link
Member

@evwilkin evwilkin left a comment

Choose a reason for hiding this comment

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

LGTM

@redallen redallen merged commit 915f03e into patternfly:master May 5, 2021
@patternfly-build
Copy link
Contributor

Your changes have been released in:

  • @patternfly/react-catalog-view-extension@4.11.13
  • @patternfly/react-code-editor@4.2.47
  • @patternfly/react-console@4.6.9
  • @patternfly/react-core@4.116.1
  • @patternfly/react-docs@5.18.15
  • @patternfly/react-inline-edit-extension@4.6.94
  • demo-app-ts@4.93.1
  • @patternfly/react-table@4.26.13
  • @patternfly/react-topology@4.8.43
  • @patternfly/react-virtualized-extension@4.7.30

Thanks for your contribution! 🎉

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.

[BUG] Toolbar window reference prevents the component to be used with SSR
5 participants