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(Masthead): add optional chaining to root.location to remove error in NextJS when rendering server-side #7681

Conversation

annawen1
Copy link
Member

Related Ticket(s)

DotcomShell component L1 not working #7678

Description

When setting up DotcomShell with L1 in NextJS template, adopter is running into an error specifically with const currentUrlPath = root.location.href;. Seems like NextJS is trying to load it server-side and throws an error that root.location is undefined. Adding optional chaining resolves this issue.

Changelog

Changed

  • add optional chaining to currentUrlPath

@annawen1 annawen1 added package: react Work necessary for the Carbon for IBM.com react components package package: web components Work necessary for the IBM.com Library web components package 👀 eyes needed labels Nov 17, 2021
@annawen1 annawen1 requested a review from a team as a code owner November 17, 2021 15:24
Copy link
Member

@jeffchew jeffchew left a comment

Choose a reason for hiding this comment

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

LGTM!

@jeffchew jeffchew added Ready to merge Label for the pull requests that are ready to merge and removed 👀 eyes needed labels Nov 17, 2021
@ibmdotcom-bot
Copy link
Contributor

@ibmdotcom-bot
Copy link
Contributor

Deploy preview created for package "Web Components (Codesandbox Examples)":
https://webcomponents-codesandbox.s3-web.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/7681/index.html

Built with commit: 28171b10f4aa8c68bb039541ebe1e3c3567aeacc

@ibmdotcom-bot
Copy link
Contributor

@kodiakhq kodiakhq bot merged commit 845cf31 into carbon-design-system:master Nov 17, 2021
@annawen1 annawen1 deleted the fix/add-optional-chaining-for-currenturlpath branch November 17, 2021 16:09
@ibmdotcom-bot
Copy link
Contributor

@ibmdotcom-bot
Copy link
Contributor

@ibmdotcom-bot
Copy link
Contributor

@ibmdotcom-bot
Copy link
Contributor

Deploy preview created for package "React (Codesandbox Examples)":
https://react-codesandbox.s3-web.us-east.cloud-object-storage.appdomain.cloud/deploy-previews/7681/index.html

Built with commit: 28171b10f4aa8c68bb039541ebe1e3c3567aeacc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package: react Work necessary for the Carbon for IBM.com react components package package: web components Work necessary for the IBM.com Library web components package Ready to merge Label for the pull requests that are ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants