File tree Expand file tree Collapse file tree 1 file changed +5
-11
lines changed
libs/cdk/render-strategies/src/lib Expand file tree Collapse file tree 1 file changed +5
-11
lines changed Original file line number Diff line number Diff line change 1
1
import { NgZone } from '@angular/core' ;
2
2
import { RxCoalescingOptions } from '@rx-angular/cdk/coalescing' ;
3
- import { switchMap , take } from 'rxjs/operators ' ;
4
- import { Observable , of , throwError } from 'rxjs' ;
3
+ import { Observable , throwError } from 'rxjs' ;
4
+ import { catchError , map , take } from 'rxjs/operators ' ;
5
5
import { RxRenderWork , RxStrategyCredentials } from './model' ;
6
6
7
7
/**
@@ -22,22 +22,16 @@ export function onStrategy<T>(
22
22
) => void ,
23
23
options : RxCoalescingOptions & { ngZone ?: NgZone } = { }
24
24
) : Observable < T > {
25
- let error : Error ;
26
25
return new Observable < T > ( ( subscriber ) => {
27
26
subscriber . next ( value ) ;
28
27
} ) . pipe (
29
28
strategy . behavior ( {
30
- work : ( ) => {
31
- try {
32
- workFactory ( value , strategy . work , options ) ;
33
- } catch ( e ) {
34
- error = e ;
35
- }
36
- } ,
29
+ work : ( ) => workFactory ( value , strategy . work , options ) ,
37
30
scope : ( options . scope as Record < string , unknown > ) || { } ,
38
31
ngZone : options . ngZone ,
39
32
} ) ,
40
- switchMap ( ( ) => ( error ? throwError ( [ error , value ] ) : of ( value ) ) ) ,
33
+ catchError ( ( error ) => throwError ( ( ) => [ error , value ] ) ) ,
34
+ map ( ( ) => value ) ,
41
35
take ( 1 )
42
36
) ;
43
37
}
You can’t perform that action at this time.
0 commit comments