Skip to content

Audit fixes - #2

Merged
AnkitSharma-007 merged 8 commits into
mainfrom
audit-fixes
Sep 2, 2026
Merged

AnkitSharma-007 merged 8 commits into
mainfrom
audit-fixes

Conversation

@AnkitSharma-007

Copy link
Copy Markdown
Owner

No description provided.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

Several new Resource API claims are inaccurate, and one asynchronous example can outlive its component.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Audits RxJS guidance, modernizes Angular examples, and adds coverage for marble testing and Resource APIs.

Changes:

  • Corrects operator semantics and interview guidance.
  • Modernizes examples for signals, zoneless Angular, and lifecycle cleanup.
  • Adds Marble Testing and RxJS-vs-Resource guides.
File summaries
File Description
README.md Clarifies project scope.
mkdocs.yml Adds new guides to navigation.
docs/subjects/subject.md Modernizes subscription example.
docs/subjects/shareReplay.md Updates component lifecycle patterns.
docs/subjects/share.md Clarifies reset behavior and modernizes examples.
docs/subjects/replaySubject.md Modernizes signal-based example.
docs/subjects/behaviorSubject.md Documents terminal behavior and updates example.
docs/operators/utility/timeout.md Corrects timeout semantics.
docs/operators/utility/tap.md Modernizes lifecycle handling.
docs/operators/utility/finalize.md Modernizes lifecycle handling.
docs/operators/utility/delay.md Corrects error timing guidance.
docs/operators/transformation/buffer.md Corrects parameter naming.
docs/operators/filtering/take.md Adds empty-stream edge cases.
docs/operators/filtering/last.md Converts state to signals.
docs/operators/filtering/first.md Converts state to signals.
docs/operators/filtering/find.md Modernizes component example.
docs/operators/filtering/distinctUntilChanged.md Clarifies comparator semantics.
docs/operators/filtering/debounceTime.md Documents completion behavior.
docs/operators/filtering/auditTime.md Refines throttle comparison.
docs/operators/error-handling/retryWhen.md Modernizes lifecycle handling.
docs/operators/error-handling/retry.md Improves retry guidance and example.
docs/operators/error-handling/catchError.md Modernizes signals and lifecycle usage.
docs/operators/creation/empty-never.md Corrects NEVER semantics and cleanup.
docs/operators/combination/zip.md Modernizes component example.
docs/operators/combination/withLatestFrom.md Modernizes forms and lifecycle usage.
docs/operators/combination/startWith.md Improves template type narrowing.
docs/operators/combination/forkJoin.md Documents empty completion.
docs/operators/combination/combineLatest.md Documents empty-source behavior.
docs/learn/unicast-vs-multicast.md Clarifies fromEvent classification.
docs/learn/schedulers.md Links marble-testing guidance.
docs/learn/promise-vs-observable.md Corrects toPromise status.
docs/learn/marble-testing.md Adds TestScheduler guide.
docs/learn/index.md Lists marble testing.
docs/learn/hot-observables.md Clarifies fromEvent and sharing.
docs/learn/cold-observables.md Updates example lifecycle.
docs/interview-prep/scenarios.md Adds route-stream cleanup.
docs/interview-prep/coding-challenges.md Clarifies retry attempt count.
docs/interview-prep/cheat-sheet-operators.md Refines operator summaries.
docs/index.md Clarifies guide scope.
docs/comparisons/switchMap-mergeMap-concatMap.md Clarifies flatMap deprecation.
docs/angular/signals-interop.md Expands interop API guidance.
docs/angular/rxjs-vs-resource.md Adds Resource API comparison.
docs/angular/router.md Corrects route-stream lifecycle explanation.
docs/angular/reactive-forms.md Adds zoneless and Signal Forms guidance.
docs/angular/interceptors-retry.md Retries timeout failures correctly.
docs/angular/index.md Lists Resource API guide.
docs/angular/http-patterns.md Improves template narrowing and Resource links.
docs/angular/caching.md Relates caching to resources.
docs/angular/async-pipe.md Modernizes inputs and zoneless guidance.
docs/angular/anti-patterns.md Uses signals for zoneless rendering.
Review details

Suppressed comments (2)

docs/angular/rxjs-vs-resource.md:59

  • This row overstates the limitation: Angular's debounced() can produce the parameter signal consumed by a resource, so a resource-based typeahead need not react to every raw keystroke. Clarify that resources do not provide an RxJS operator pipeline themselves, rather than saying they cannot support debounced fetching.
| Debounce user input before fetching      | `params` reacts to every change immediately       | [`debounceTime`](../operators/filtering/debounceTime.md)                                                            |

docs/angular/rxjs-vs-resource.md:88

  • This answer repeats the incorrect claim that a resource cannot debounce. In current Angular, debounced() plus httpResource handles both the quiet period and stale-request cancellation, so it is a valid signal-native answer for a straightforward typeahead; RxJS is needed only when additional event-stream behavior justifies it.
    Because typeahead is mostly not a fetching problem. The pipeline needs debouncing (a resource's `params` reacts to every keystroke instantly) and deliberate cancellation of the settled-but-stale request. A resource does abort on params changes, but it cannot debounce, dedupe, or throttle them. The strong answer: debounce and shape the stream with RxJS, then hand the final fetch to `rxResource`, or keep `switchMap` + `toSignal`.
  • Files reviewed: 50/50 changed files
  • Comments generated: 4
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/operators/filtering/first.md Outdated
Comment thread docs/angular/rxjs-vs-resource.md Outdated
Comment thread docs/angular/signals-interop.md Outdated
Comment thread docs/operators/combination/withLatestFrom.md

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

The Resource API comparison contains several inaccurate capability claims, and one teardown explanation remains stale.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

docs/angular/signals-interop.md:116

  • This rejects debounced() on the basis that it cannot cancel stale requests, but pairing its settled value with httpResource provides the same cancellation point: when the next settled parameter arrives, the resource aborts the prior HTTP request. Explain that this native pair is valid for simple typeahead and use the RxJS version when its broader stream composition is needed.
**"Why not `debounced()`?"** Angular ships a (currently experimental) `debounced()` helper that debounces a signal's value, and Signal Forms has its own field-level debouncing. For the plain search case, a debounced signal driving `httpResource` is a legitimate composition: the debounce settles the parameter and `httpResource` cancels the stale request on each change. The stream pipeline earns its place when the requirement grows past that pairing: skipping unchanged values (`distinctUntilChanged`), retry with backoff, combining several inputs, cancelling non-HTTP work (any inner Observable, not just requests), or keeping the entire policy in one reviewable pipeline. Naming that boundary, rather than defending RxJS reflexively, is the strong interview answer. Full decision guide: [RxJS or the Resource API?](rxjs-vs-resource.md)

docs/operators/combination/withLatestFrom.md:128

  • The code now uses no-argument takeUntilDestroyed() in the constructor, but the numbered explanation below still documents takeUntilDestroyed(this.destroyRef), even though destroyRef was removed. Update that explanation so readers do not look for a nonexistent field.
        takeUntilDestroyed(), // constructor is an injection context
  • Files reviewed: 50/50 changed files
  • Comments generated: 7
  • Review effort level: Balanced

A resource is a reactive fetch bound to signal inputs. When the `params` computation changes, the loader re-runs and the previous request is aborted:

```typescript
import { Component, inject, input } from "@angular/core";

| Need | Why a resource cannot | RxJS tool |
| ---------------------------------------- | ------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- |
| Debounce user input before fetching | `params` reacts to every change immediately | [`debounceTime`](../operators/filtering/debounceTime.md) |
| Debounce user input before fetching | `params` reacts to every change immediately | [`debounceTime`](../operators/filtering/debounceTime.md) |
| Retry with backoff, gated by error type | Loader failure goes straight to `error()` | [`retry({ count, delay })`](../operators/error-handling/retry.md) |
| Queue or drop bursts (saves, submits) | One loader per params change, latest wins, always | [`concatMap`](../operators/transformation/concatMap.md) / [`exhaustMap`](../operators/transformation/exhaustMap.md) |
| Combine several live sources | Resources track one params computation | [`combineLatest`](../operators/combination/combineLatest.md), [`merge`](../operators/combination/merge.md) |
| Retry with backoff, gated by error type | Loader failure goes straight to `error()` | [`retry({ count, delay })`](../operators/error-handling/retry.md) |
| Queue or drop bursts (saves, submits) | One loader per params change, latest wins, always | [`concatMap`](../operators/transformation/concatMap.md) / [`exhaustMap`](../operators/transformation/exhaustMap.md) |
| Combine several live sources | Resources track one params computation | [`combineLatest`](../operators/combination/combineLatest.md), [`merge`](../operators/combination/merge.md) |
| Share one execution among many consumers | Each resource owns its own loader | [`shareReplay`](../subjects/shareReplay.md) |
| Queue or drop bursts (saves, submits) | One loader per params change, latest wins, always | [`concatMap`](../operators/transformation/concatMap.md) / [`exhaustMap`](../operators/transformation/exhaustMap.md) |
| Combine several live sources | Resources track one params computation | [`combineLatest`](../operators/combination/combineLatest.md), [`merge`](../operators/combination/merge.md) |
| Share one execution among many consumers | Each resource owns its own loader | [`shareReplay`](../subjects/shareReplay.md) |
| Continuous streams (WebSockets, events) | The loader resolves once per request | Subjects, [`fromEvent`](../operators/creation/fromEvent.md), `resource`'s `stream` option for simple cases |
Comment thread docs/angular/rxjs-vs-resource.md Outdated

??? question "Why not just use httpResource for the typeahead search?"

Because typeahead is mostly not a fetching problem. The pipeline needs debouncing (a resource's `params` reacts to every keystroke instantly) and deliberate cancellation of the settled-but-stale request. A resource does abort on params changes, but it cannot debounce, dedupe, or throttle them. The strong answer: debounce and shape the stream with RxJS, then hand the final fetch to `rxResource`, or keep `switchMap` + `toSignal`.

## The Rest of the Interop Package

Three more exports round out `@angular/core/rxjs-interop`, and all are fair interview game precisely because they live in the RxJS interop layer:
@AnkitSharma-007
AnkitSharma-007 merged commit 44dc503 into main Sep 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants