Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

fix: ssr exception in runtime #19

Merged
merged 2 commits into from
Nov 8, 2019
Merged

Conversation

osnoser1
Copy link
Contributor

@osnoser1 osnoser1 commented Nov 4, 2019

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

In SSR runtime occurs two exceptions: window and document is not defined.

Issue Number: #18

What is the new behavior?

All exceptions are gone in ssr.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This PR has two commits:

  • The first prepare the application for be executed in ssr.
  • The second commit apply the fix. This consists is to update the IntersectionObserver polyfill for avoid the window exception, not create the IntersectionObserver instance in ssr because it isn't work, and inject the document by angular because in ssr that it is created by domino library that angular uses since version 6 .

Closes #18

@dianjuar
Copy link
Member

dianjuar commented Nov 4, 2019

@osnoser1 can you please describe the PR?
You can use the Angular PR template to do that.

I have no experience on this field and would be nice to have an explanation instead of reading code to understand what was wrong

@osnoser1
Copy link
Contributor Author

osnoser1 commented Nov 4, 2019

Done @dianjuar 👍🏼

angular.json Show resolved Hide resolved
projects/sticky-directive/src/lib/sticky.directive.ts Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
@dianjuar
Copy link
Member

dianjuar commented Nov 5, 2019

@osnoser1 Your PR is just awesome!

I will run Unit Test and Sonar Analysis (I now, I now, the CI should be doing this)and tell you how it went.

If nothing happens I will integrate your PR.

THANK YOU!!!!!

@dianjuar dianjuar merged commit 08761ca into bikecoders:master Nov 8, 2019
@osnoser1 osnoser1 deleted the bugfix/ssr branch November 9, 2019 07:46
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

On SSR gives ReferenceErrors for window and document
2 participants