-
Notifications
You must be signed in to change notification settings - Fork 12
Wave 2: Upgrade to RxJS 7 and remove rxjs-compat #422
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: devin/1782984123-angular20-core-upgrade
Are you sure you want to change the base?
Changes from all commits
5834a7b
687be87
f117d91
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.
|
devin-ai-integration[bot] marked this conversation as resolved.
|
|
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: Subtle RxJS 7 behavioral change in lazyFetch error-after-complete scenario In 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 — this is an informational behavioral note (worst case a console warning via
devin-ai-integration[bot] marked this conversation as resolved.
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: Nested subscribe inside map operator is a pre-existing anti-pattern that could cause race conditions with polls The (Refers to lines 23-37) 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. Agreed this nested-subscribe-in- 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: Custom Observable wrapper in lazyFetch is compatible with RxJS 7 but has a pre-existing teardown gap The (Refers to lines 51-68) Was this helpful? React with 👍 or 👎 to provide feedback. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| import { Injectable } from '@angular/core'; | ||
| import { Observable } from 'rxjs/Observable'; | ||
| import { Observable } from 'rxjs'; | ||
| import fetch from 'unfetch'; | ||
| import {map } from 'rxjs/operators'; | ||
|
|
||
|
|
@@ -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: err => console.error('Could not load poll option', story.id + i, err) | ||
| }); | ||
|
Comment on lines
+29
to
35
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: New poll error handler prevents unhandled errors in RxJS 7 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 comment
The reason will be displayed to describe this comment to others. Learn more.
📝 Info: Feed list position and scroll only update on success, not on error
The
completecallback at lines 43-46 setslistStartand callswindow.scrollTo(0, 0). Since RxJS observables do not callcompleteaftererror, these side effects are skipped when the feed fetch fails. This was the same behavior before the migration (the third positional argument tosubscribewas the complete handler), but it's worth noting: on error,listStartretains its previous value and the page doesn't scroll to top. If the user navigates from page 2 (wherelistStart=31) and the next page errors, the stalelistStartcould cause a confusing numbered list if items are later displayed.Was this helpful? React with 👍 or 👎 to provide feedback.