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(docs-infra): use setInterval from window instead of the default from nodeJS #48048

Closed
wants to merge 1 commit into from

Conversation

bastienmoulia
Copy link

PR Checklist

Please check if your PR fulfills the following requirements:

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?

Error in stackblitz

Issue Number: #48047

What is the new behavior?

No error in stackblitz

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@pullapprove pullapprove bot requested a review from atscott November 14, 2022 16:21
@ngbot ngbot bot added this to the Backlog milestone Nov 14, 2022
Copy link
Contributor

@alan-agius4 alan-agius4 left a comment

Choose a reason for hiding this comment

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

window should not be used directly as this would make code non SSR compliant.

What is happening here is that @types/node is being included through 3rd party dependencies, in tsconfig.json we include all @types/ and in this case @types/node overrides the type of the setInterval.

Couple of ways to solve this;

  1. Disable the inclusion of types in tsconfig.json
  2. Refactor code to be agnostic of platform, instead of storing an interval, store a tear down method.
const interval = setInterval(() => {
  this.loadComponent();
}, 3000);

this.stopInterval = () => clearInterval(interval);

@alan-agius4
Copy link
Contributor

Thanks for your contribution but this has been superseded by #48480.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 10, 2023
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.

None yet

3 participants