-
Notifications
You must be signed in to change notification settings - Fork 12
chore: upgrade RxJS to v7 and migrate deprecated APIs #427
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
base: upgrade/angular-core
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,7 +21,7 @@ | |
| "@angular/router": "~20.3.25", | ||
| "@angular/service-worker": "~20.3.25", | ||
| "node-fetch": "^2.6.0", | ||
| "rxjs": "~6.5.4", | ||
| "rxjs": "^7.8.0", | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Broad version range for RxJS allows all future 7.x releases The version specifier changed from Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acknowledged — |
||
| "tslib": "^2.6.0", | ||
| "unfetch": "^4.1.0", | ||
| "zone.js": "~0.15.0" | ||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: app.component.ts still uses single-callback subscribe form The Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct — single-argument |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,4 @@ | ||
| import { Component, OnInit } from '@angular/core'; | ||
| import { Observable } from 'rxjs'; | ||
| import { Subscription } from 'rxjs'; | ||
| import { ActivatedRoute } from '@angular/router'; | ||
|
|
||
|
|
@@ -37,14 +36,14 @@ export class FeedComponent implements OnInit { | |
| this.pageSub = this.route.params.subscribe(params => { | ||
| this.pageNum = params['page'] ? +params['page'] : 1; | ||
| this._hackerNewsAPIService.fetchFeed(this.feedType, this.pageNum) | ||
| .subscribe( | ||
| items => this.items = items, | ||
| error => this.errorMessage = 'Could not load ' + this.feedType + ' stories.', | ||
| () => { | ||
| .subscribe({ | ||
| next: items => this.items = items, | ||
| error: () => this.errorMessage = 'Could not load ' + this.feedType + ' stories.', | ||
| complete: () => { | ||
| this.listStart = ((this.pageNum - 1) * 30) + 1; | ||
| window.scrollTo(0, 0); | ||
| } | ||
|
Comment on lines
+42
to
45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 Info: Feed list numbering and scroll position are skipped on error, same as before The Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Correct — |
||
| ); | ||
| }); | ||
| }); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,9 +26,12 @@ export class HackerNewsAPIService { | |
| let numberOfPollOptions = story.poll.length; | ||
| story.poll_votes_count = 0; | ||
| for (let i = 1; i <= numberOfPollOptions; i++) { | ||
| this.fetchPollContent(story.id + i).subscribe(pollResults => { | ||
| story.poll[i - 1] = pollResults; | ||
| story.poll_votes_count += pollResults.points; | ||
| this.fetchPollContent(story.id + i).subscribe({ | ||
| next: pollResults => { | ||
| story.poll[i - 1] = pollResults; | ||
| story.poll_votes_count += pollResults.points; | ||
| }, | ||
| error: () => { /* poll option fetch failed; leave partial data */ } | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🚩 Silent error swallowing for poll fetches is a behavioral change The old code at Was this helpful? React with 👍 or 👎 to provide feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Acknowledged. The silent handler is intentional — poll options are supplementary data fetched inside a |
||
| }); | ||
| } | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.