Skip to content

check to see if window is defined #349

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

Merged
merged 5 commits into from
Feb 4, 2025
Merged

check to see if window is defined #349

merged 5 commits into from
Feb 4, 2025

Conversation

britt6612
Copy link
Collaborator

need to add a check to see if the window is defined

@britt6612 britt6612 requested review from taysea and jcfilben February 4, 2025 20:46
src/js/utils.js Outdated
let rootFontSize = parseMetricToNum(FALLBACK);
if (typeof window !== 'undefined') {
rootFontSize = parseMetricToNum(
window?.getComputedStyle(document.body).getPropertyValue('font-size') || FALLBACK,
Copy link
Collaborator

Choose a reason for hiding this comment

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

This line I got some reformatting from prettier locally

Copy link
Collaborator

@jcfilben jcfilben left a comment

Choose a reason for hiding this comment

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

Looks good! Tested with yalc on grommet-site

@britt6612 britt6612 merged commit 7bd26f7 into master Feb 4, 2025
9 checks passed
@jcfilben jcfilben deleted the fix-window-undefined branch February 4, 2025 21:11
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.

3 participants