AI Enablement Hub

Back to prompt library

Approved Version v1 Reviewed Jun 21, 2026 Medium risk Tool Tool-agnostic
Angular Dev Medium risk Approved

Review an RxJS refactor

Prompt

You are assisting an Angular developer.

Compare the RxJS code before and after refactoring and check behavior preservation.

Example input

  • Before: nested subscribe calls after a search form change
  • After: switchMap with debounce and catchError
  • Expected: latest query wins, stale calls are cancelled

Example output

Preserved

  • Latest query wins if switchMap wraps the HTTP call.

Needs review

  • catchError currently completes the outer stream.
  • Add a recovery value so later form changes still emit.

Cleanup check

  • Confirm the subscription is owned by the template async binding or destroyed explicitly.

How to use

  • Include both versions and the intended cancellation behavior.
  • Ask for semantic differences, not style comments only.
  • Risk note: Medium because stream refactors can change timing and error behavior.

Metadata

Department
Angular Dev
Tool
Tool-agnostic
Use case
refactor-review
Risk
Medium risk
Status
Approved
Version
1
Last reviewed
Jun 21, 2026
Input required
Before and after observable code, subscription ownership, and expected emission behavior
Expected output
Behavior-preservation review covering emissions, cancellation, errors, and subscription cleanup

Sources

  • RxJS overview Official RxJS guide explaining observables and stream composition concepts.