Skip to content

fix(docs-infra): initialize events arrays in EventsComponent#47458

Closed
dario-piotrowicz wants to merge 1 commit intoangular:mainfrom
dario-piotrowicz:aio-optional-chaining-warning
Closed

fix(docs-infra): initialize events arrays in EventsComponent#47458
dario-piotrowicz wants to merge 1 commit intoangular:mainfrom
dario-piotrowicz:aio-optional-chaining-warning

Conversation

@dario-piotrowicz
Copy link
Contributor

initialize the events fields of the EventsComponent so that they are always defined

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?

Issue Number: N/A

When running the aio app locally the following warning gets shown in the terminal:

Screenshot at 2022-09-15 22-54-15

What is the new behavior?

The upcomingEvents gets initialized to [], so it is always defined and no optional chaining is needed (I could have made the field optional and that would also have solved the issue, but I figured it could be cleaner to initialize the array instead)

I've also initialized the pastEvents for consistency, it is also directly accessed without checks so I assume that it should be initialized (strangely, but I removed its assignment and I wasn't getting any runtime error...)

Does this PR introduce a breaking change?

  • Yes
  • No

@pullapprove pullapprove bot requested a review from josephperrott September 15, 2022 22:14
initialize the events fields of the EventsComponent so that
they are always defined
@dario-piotrowicz dario-piotrowicz force-pushed the aio-optional-chaining-warning branch from d1cfac1 to 16d2ef7 Compare September 15, 2022 22:46
@gkalpak gkalpak removed the request for review from josephperrott September 16, 2022 08:34
@gkalpak gkalpak added type: bug/fix action: merge The PR is ready for merge by the caretaker comp: docs-infra target: patch This PR is targeted for the next patch release labels Sep 16, 2022
@ngbot ngbot bot modified the milestone: Backlog Sep 16, 2022
@pkozlowski-opensource
Copy link
Member

This PR was merged into the repository by commit 5fb7ae2.

pkozlowski-opensource pushed a commit that referenced this pull request Sep 16, 2022
initialize the events fields of the EventsComponent so that
they are always defined

PR Close #47458
vyom1611 pushed a commit to vyom1611/angular that referenced this pull request Sep 18, 2022
…#47458)

initialize the events fields of the EventsComponent so that
they are always defined

PR Close angular#47458
@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 Oct 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants