We commonly use this pattern in DSpace Angular:
- Component method
returnSomething$() returns an Observable
- Called from the template, with
| async
Effectively this causes the RxJS pipe to be executed again for each change detection cycle, often leading to performance issues.
We should look into introducing an ESLint rule to guard against this.
Existing cases should be rewritten into the following pattern:
- Subscribe within
ngOnInit()
- Pass emitted values to a
BehaviorSubject; this will be the new target for | async
- Unsubscribe within
ngOnDestroy()
We commonly use this pattern in DSpace Angular:
returnSomething$()returns an Observable| asyncEffectively this causes the RxJS pipe to be executed again for each change detection cycle, often leading to performance issues.
We should look into introducing an ESLint rule to guard against this.
Existing cases should be rewritten into the following pattern:
ngOnInit()BehaviorSubject; this will be the new target for| asyncngOnDestroy()