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: server-side rendering errors in linear progress and slider #5792

Merged
merged 1 commit into from
Apr 9, 2020

Conversation

crisbeto
Copy link
Collaborator

@crisbeto crisbeto commented Apr 7, 2020

The linear progress and slider components were trying to access window as a global directly which will throw under Node environments. These changes add a typeof guard infront of it to avoid the error.

Note: ideally getCorrectPropertyName and getCorrectEventName would get the window themselves manually and would do the typeof check internally, but it seems like the windowObj parameter is used when unit testing and there's no nice way around it. Also changing the signature would be a breaking change.

The linear progress and slider components were trying to access `window` as a global directly which will throw under Node environments. These changes add a `typeof` guard infront of it to avoid the error.
@crisbeto crisbeto requested a review from abhiomkar April 7, 2020 16:46
@copybara-service copybara-service bot merged commit bce00e1 into material-components:master Apr 9, 2020
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 10, 2020
…progress bar

I got some changes in with material-components/material-components-web#5792 which allow us to properly render a progress bar during server-side rendering, instead of turning it into a noop. These changes remove all of the `isBrowser` checks.

I also removed the `isBrowser` check from the MDC checkbox, because the `offsetWidth` access is safe, even though the property might be undefined.
crisbeto added a commit to crisbeto/material2 that referenced this pull request Apr 10, 2020
…progress bar

I got some changes in with material-components/material-components-web#5792 which allow us to properly render a progress bar during server-side rendering, instead of turning it into a noop. These changes remove all of the `isBrowser` checks.

I also removed the `isBrowser` check from the MDC checkbox, because the `offsetWidth` access is safe, even though the property might be undefined.
andrewseguin pushed a commit to angular/components that referenced this pull request Apr 17, 2020
…progress bar (#19036)

I got some changes in with material-components/material-components-web#5792 which allow us to properly render a progress bar during server-side rendering, instead of turning it into a noop. These changes remove all of the `isBrowser` checks.

I also removed the `isBrowser` check from the MDC checkbox, because the `offsetWidth` access is safe, even though the property might be undefined.
andrewseguin pushed a commit to angular/components that referenced this pull request Apr 17, 2020
…progress bar (#19036)

I got some changes in with material-components/material-components-web#5792 which allow us to properly render a progress bar during server-side rendering, instead of turning it into a noop. These changes remove all of the `isBrowser` checks.

I also removed the `isBrowser` check from the MDC checkbox, because the `offsetWidth` access is safe, even though the property might be undefined.

(cherry picked from commit 5d25d1b)
soro-google pushed a commit to soro-google/components that referenced this pull request Apr 24, 2020
…progress bar (angular#19036)

I got some changes in with material-components/material-components-web#5792 which allow us to properly render a progress bar during server-side rendering, instead of turning it into a noop. These changes remove all of the `isBrowser` checks.

I also removed the `isBrowser` check from the MDC checkbox, because the `offsetWidth` access is safe, even though the property might be undefined.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants