diff --git a/packages/nx/src/data-persistence.ts b/packages/nx/src/data-persistence.ts index 05edd04bdb..eb6b979f9b 100644 --- a/packages/nx/src/data-persistence.ts +++ b/packages/nx/src/data-persistence.ts @@ -237,9 +237,9 @@ export class DataPersistence { actionType: string, opts: PessimisticUpdateOpts ): Observable { - const nav = this.actions.ofType(actionType); - const pairs = nav.pipe(withLatestFrom(this.store)); - return pairs.pipe(pessimisticUpdate(opts)); + return this.actions + .ofType(actionType) + .pipe(withLatestFrom(this.store), pessimisticUpdate(opts)); } /** @@ -292,9 +292,9 @@ export class DataPersistence { actionType: string, opts: OptimisticUpdateOpts ): Observable { - const nav = this.actions.ofType(actionType); - const pairs = nav.pipe(withLatestFrom(this.store)); - return pairs.pipe(optimisticUpdate(opts)); + return this.actions + .ofType(actionType) + .pipe(withLatestFrom(this.store), optimisticUpdate(opts)); } /** @@ -368,10 +368,9 @@ export class DataPersistence { actionType: string, opts: FetchOpts ): Observable { - const nav = this.actions.ofType(actionType); - const allPairs = nav.pipe(withLatestFrom(this.store)); - - return allPairs.pipe(fetch(opts)); + return this.actions + .ofType(actionType) + .pipe(withLatestFrom(this.store), fetch(opts)); } /** @@ -411,9 +410,10 @@ export class DataPersistence { component: Type, opts: HandleNavigationOpts ): Observable { - const nav = this.actions; - const pairs = nav.pipe(withLatestFrom(this.store)); - return pairs.pipe(navigation(component, opts)); + return this.actions.pipe( + withLatestFrom(this.store), + navigation(component, opts) + ); } }