![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
ng2-rx-collector
Advanced tools
Angular 2 garbage collector for RxJS subscriptions.
Benefits:
ngOnDestroy
for cancelling subscriptions anymore (but still you can use it if you want)Inspired by philipooo's beautiful answer.
npm install --save ng2-rx-collector
Import the Collected
decorator and CollectorEvent
data type which will do all the magic.
import { Collected, CollectorEvent } from 'ng2-rx-collector';
Then create a property on your component which will represent the collector stopper event.
@Component({ ... })
export class MyComponent {
@Collected() private collected = new CollectorEvent();
}
Subscribe to any observable / subject using the created property as a flag, so the observable will stop producing the output when the component is being destroyed:
public ngOnInit() {
myObservable.takeUntil(this.collected)
.subscribe(console.log.bind(console));
Observable.merge(myObservable1, myObservable2)
.takeUntil(this.collected)
.subscribe(console.log.bind(console));
}
That is pretty much it.
This is an example you may find in an app folder.
timer.ts (representing any RxJS source):
import { Observable } from 'rxjs';
export let timer = Observable.interval(1000);
testpage.component.ts (representing any Rx source):
import { Component } from '@angular/core';
import { Collected, CollectedEvent } from './src';
import { timer } from './timer';
@Component({
template: 'Ticking'
})
export class TestpageComponent {
@Collected() private collected: CollectedEvent;
public ngOnInit() {
timer.takeUntil(this.collected)
.subscribe(console.log.bind(console));
}
public ngOnDestroy() {
console.log('unnecessary destroy works, subscription is still killed');
}
}
MIT
FAQs
Angular 2 garbage collector for RxJS subscriptions
The npm package ng2-rx-collector receives a total of 2 weekly downloads. As such, ng2-rx-collector popularity was classified as not popular.
We found that ng2-rx-collector demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.