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

getComputedStyle on SSR Universal #314

Open
2 tasks
gvestit opened this issue Mar 1, 2023 · 4 comments
Open
2 tasks

getComputedStyle on SSR Universal #314

gvestit opened this issue Mar 1, 2023 · 4 comments

Comments

@gvestit
Copy link

gvestit commented Mar 1, 2023

  • I'm submitting a ...

    • [ X] bug report
    • feature request
    • support request => Please do not submit support request here, see note at the top of this template.
  • Do you want to request a feature or report a bug?
    Report a bug

  • What is the current behavior?
    When we are rendering on server side the component which is using this library we are getting the error "ReferenceError: getComputedStyle is not defined" on server side.

  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

ReferenceError: getComputedStyle is not defined
3|main | at DragScrollComponent.ngAfterViewInit (server/447.js:1:41636)
3|main | at callHook (server/main.js:1:2487534)
3|main | at callHooks (server/main.js:1:2487151)
3|main | at executeInitAndCheckHooks (server/main.js:1:2486487)
3|main | at refreshView (server/main.js:1:2630872)
3|main | at refreshComponent (server/main.js:1:2648689)
3|main | at refreshChildComponents (server/main.js:1:2626715)
3|main | at refreshView (server/main.js:1:2630553)
3|main | at refreshEmbeddedViews (server/main.js:1:2647970)
3|main | at refreshView (server/main.js:1:2630083)

@quedicesebas
Copy link

With SSR?

@apappas1129
Copy link

Probably just have to wrap everything in ngAfterViewInit here with afterNextRender.

@Malhar-Naliyapara
Copy link

Malhar-Naliyapara commented Oct 21, 2024

October 2024, Still facing issue using SSR. Can not get the getComputedStyle as can not get window in SSR. Any update on that ?

@apappas1129
Copy link

October 2024, Still facing issue using SSR. Can not get the getComputedStyle as can not get window in SSR. Any update on that ?

Can you provide the error message with what line of code it is referring to? For example, I think the window access is handled properly here:

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

No branches or pull requests

4 participants