Skip to content
This repository was archived by the owner on Jan 13, 2025. It is now read-only.

fix: server-side rendering errors in linear progress and slider - #5792

Merged
copybara-service[bot] merged 1 commit into
material-components:masterfrom
crisbeto:ssr-errors
Apr 9, 2020
Merged

fix: server-side rendering errors in linear progress and slider#5792
copybara-service[bot] merged 1 commit into
material-components:masterfrom
crisbeto:ssr-errors

Conversation

@crisbeto

@crisbeto crisbeto commented Apr 7, 2020

Copy link
Copy Markdown
Collaborator

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
@abhiomkar
abhiomkar requested a review from allan-chen April 7, 2020 17:01
@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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants