Questions tagged [rxjs]

The Reactive Extensions for JavaScript (RxJS) is a set of libraries for composing asynchronous and event-based programs using observable collections and Array Extras style composition.

0
votes
0answers
20 views

Angular&rxjs: autocomplete race condition problem

I have this code for returning data from my api: private searchTerm = new Subject<string>(); public termsArray: any = []; constructor(private apiService: DataService){ this....
0
votes
0answers
10 views

IE screen freezed during long pooling RxJS 6 and Angular 6

I have following case. Frontend sends requests to server for id, then immediately the next request is sent and the long pooling starts because if the response comes, I will send next request to this ...
0
votes
0answers
10 views

redux-observable: epic unit test for Epic error case

In my project, I use redux-observable to handle the async HTTP staff. I came across an issue about unit testing about the epic. The epic is as below: export const epic = (action$, store, { Api }) =&...
0
votes
0answers
12 views

Defining the result of combineLatest once

Is there a more effective way to access the array? const combineLatestResult$ = combineLatest( firstObservable$, secondObservable$, thirdObservable$, ); combineLatestResult$.pipe( take(1), ...
3
votes
1answer
22 views

RxJS: Throttle rate-limited API calls

I've been working (and searching) on finding a solution for this for a few days, and while the following works, I can't help but feel there's a more rxjs-y way of doing this. I have an array of URLs ...
0
votes
2answers
32 views

Typescript Observables http.post and http.get Handing Question

I am working on a project where I am building a simple front end in Angular (typescript) / Node to make call to a back end server for executing different tasks. These tasks take time to execute and ...
0
votes
1answer
16 views

How can I select all ids of items bound to an observable using Async Pipe with a button click?

I have a table bound using Async Pipe, and have a button outside of the table which, when clicked, needs to fill an array of all the Id's of the items bound in the table. Is the proper way to create ...
1
vote
1answer
22 views

Angular 6 - How to assign a member to a result of a subscribtion in

I have the following code: m_SystemOptions: KeyValueEntity[]; OnInitializeFramework(): any { this.GetSystemSettings().subscribe( response => { ...
1
vote
3answers
28 views

Angular Observer catch error on Component

I have this code on my component this.authService.login4(this.email, this.password) .pipe(first()) .subscribe( data => { console.log(data); ...
0
votes
0answers
21 views

RxJS delay on observable of string

How can I add a delay on an Observalbe? Here is my code (this code is on a pipe): @Pipe({ name: 'toTitle', pure: false }) export class ToTitlePipe implements PipeTransform { constructor(...
1
vote
1answer
41 views

Filter based on other observable's recent past messages

I'm trying to filter messages out of an observable based on the messages of another observable. navCmds --A----B---C--A------D-----------------C-----D----E---> navNotifications ----A----...
0
votes
0answers
26 views

How to make asynchronous co-routines with rxjs observables?

I have dialogue-based protocol. Questioning side should: generate a question wait for an answer and consume it continue to next question or stop asking Answering side should: receive a question ...
0
votes
1answer
18 views

RXJS Action not firing on iOS

I've got a very bizarre issue with this epic. It's working fine on desktop, android but not working at all on iOS.. well it never picks up the action. I'm sure the action is being fired (but I've not ...
0
votes
2answers
37 views

takeUntil does not work with BehaviorSubject

I have the following BehaviorSubject defined: private posts = new BehaviorSubject<any[]>([]); and on init: ngOnInit() { this.posts .takeUntil(!this._postsLoaded) .subscribe(x =&...
0
votes
0answers
28 views

Can't get takeUntil to cancel the request

After dispatching SEARCH, I'm trying to cancel an AJAX request but also to keep the observable listening. I'm using takeUntil and waiting for an action of type CLEAR_SEARCH_RESULTS to cancel the ...
-1
votes
1answer
44 views

Waiting for observable to finish - Angular

I'm using Angular and Firebase storage to upload images and I'm having the problem where my urlImg it's undefined when I try to print it in the console.log inside of the tap. this.snapshot = this....
0
votes
0answers
18 views

RxDB populate an array within an array of objects from another collection

I am trying to populate an array of id's from another collection My JsonSchema looks like this: { version: 0, type: "object", properties: { id: { type: "string", primary: true ...
2
votes
1answer
48 views

Angular 7 upgrade : RxJs switchMap and return type of ObservableInput<void>

This code compiled and worked in Angular 6 : import { of } from 'rxjs'; import { switchMap } from 'rxjs/operators'; switchMap((term) => { if (term.trim().length > 3) ...
0
votes
0answers
32 views

Buffer N values per second RxJava, Project Reactor

I have a stream with some values: Flux<Integer> stream = getStream(); And I was trying to implement N items per second functionality stream.bufferTimeout(MAX_SIZE_TWO, _1_SECOND).subscribe(...
2
votes
1answer
35 views

queueScheduler in rx.js 6.3 is synchronous - why this example doesn't causes SO If I use queueScheduler?

I have interesting example, not a real-life task but anyway: const signal = new Subject(); let count = 0; const somecalculations = (count) => console.log('do some calculations with ', count); ...
0
votes
1answer
41 views

Using Websocket Subscribe call multiple times?

My Web-socket-service.ts import { Injectable } from '@angular/core'; import { OidcSecurityService } from 'angular-auth-oidc-client'; import { WebSocketSubject } from 'rxjs/observable/dom/...
2
votes
1answer
34 views

defer() no longer allows the observable return type

Today I did an upgrade from angular 6 to 7 Along with it I had to upgrade rxjs from 6.1.0 to 6.3.3 and typescript from 2.7.2 to 3.1.1 And now this ngrx effects method is throwing a typescript error: ...
0
votes
1answer
30 views

How to gets user id and returns his posts with their comments n angular 6

How gets all users from their user id and iterate it, and when i click a specific user i get all his post and comments? you can fetch the posts from this API: https://jsonplaceholder.typicode.com/...
1
vote
1answer
40 views

Angular 4 unsubscribe causes an error when navigating

I have recently learnt to avoid memory leak, I need to unsubscribe in my components. To do this I implement OnDestroy but this has caused an issue when navigating. ERROR Error: Uncaught (in promise)...
0
votes
1answer
25 views

Replay cached items in reverse order on subscribe

I have a ConnectableObservable which upon subscribe, will replay the last x items in their original order (oldest to newest) and any subsequent events after. I am using this Observable as the backing ...
0
votes
1answer
30 views

push to observable variable in angular

How would I add an extra object to a collection which has been initially subscribed to an observable from the template. So I have a variable in my component which is an observable and then I do some ...
0
votes
1answer
15 views

Ionic build error Cannot find module './scheduler/Action'

So I have been developing an ionic app and when I build it I got this error . Here is the full code of the image. PS D:\MEGA\proyectos\ionic\6- gag2> ionic cordova build android > ionic-app-...
0
votes
0answers
11 views

RxJS switchMap and publishReplay not operating as expected

When using switchMap on an Observable created from a Promise, publishReplay does not fire any events. this.detail = this.route.params.pipe( switchMap((params) => from(this.service.get(params.id)...
6
votes
1answer
43 views
+100

AngularFirebaseAuth : Calling server api just after firebase auth?

My auth is based on 2 things : firebase auth (email/password) call on a server API to retrieve full customer entity from BDD and from firebaseID (user must exists) So a user will be "authenticated" ...
4
votes
2answers
67 views

tranforming RxJS Observable

I use angularFirestore to query on firebase and I want join data from multiple documents using the DocumentReference. The first operator map in the pipe return an array of IOrderModelTable, the ...
0
votes
3answers
50 views

Unsubscribing to an observable because of memory leak

I have a back-end service which returns some data when we hit one of its endpoint using HTTP service. Now in angular, what we do is using Observables. We subscribe to an end-point. Something like this ...
0
votes
2answers
17 views

Do some action after takeUntil

I'm listening to mousemove event until mouseup. I'm doing it with takeUntil. My code: const onMouseMove = fromEvent(window, "mousemove"); const onMouseUp = fromEvent(window, "mouseup"); ...
-1
votes
1answer
22 views

Rewrite the code from Angular/RXJS 4 to the 6 [duplicate]

I'm having great difficulty rewriting this code for angular 6. My angular application is giving frequent errors with the RXJS library. I have even tried to install Rxjs-compat, but so far, nothing has ...
0
votes
1answer
35 views

RxJs equivalent of Promise.all()

What is the RxJs equivalent of Promise.all() whereby the then block only executes when all promises are resolved? const request1 = this.http.get('/api/hello').toPromise() // returns a promise const ...
-1
votes
3answers
57 views

RxJs equivalent of promise chain

When chaining API calls with promises I do this: this.http.get('/api/hello').toPromise().then(res => { return this.http.get('/api/there/' + res.id).toPromise() }).then(res => { console.log('...
0
votes
0answers
21 views

catchError in resolver with ngrx, working until item already exists in state

I have this resolver that upon navigating to a different page, has a productThroughStore$ observable that checks to see if a product with that id exists in the state and if it exists, it goes through ...
0
votes
0answers
22 views

Angular IE11 returns CORS error but data still returns

I'm using Angular 6 with RXJS. Making requests using HttpClient and HttpParams is returning the error XMLHttpRequest: Network Error 0x80070005, Access is denied. Which, based on research, should be a ...
0
votes
1answer
15 views

RxJS AJAX detect request is done from progressSubscriber ( whether success or error )

I am really new to RxJS and I have a question regarding RxJS ajax request. I need to implement progressSubscriber to the AjaxRequest of RxJS ( because I need progress bar displayed from 0% to 100% ). ...
0
votes
2answers
36 views

Angular 5 intercept - requests are duplicated

I am using an interceptor with HttpInterceptor in angular 5 and I have a problem with rxjs where all my http requests are duplicated. import { Router } from '@angular/router'; import { Injectable, ...
0
votes
1answer
29 views

Unexpected toHaveBeenCalled on catchError (RxJS)

I am using the Angular 6 Tour of Heroes application and am attempting to write unit tests for HeroService.getHeroes(). The HeroService is defined as: import { Injectable } from '@angular/core'; ...
0
votes
1answer
39 views

Angular 6 + Ngrx state value update without using action

I have a simple state : export interface ItemsState{ items: Item[], otherItem: OtherItem, } const initialState: ItemsState= { items: [], otherItem: {} as OtherItem, } And a selector : ...
2
votes
1answer
33 views

In RxJS, why does a pipe get executed once for each subscription?

I want to have multiple subscriptions to react to an observable event, but I want to log the event as well, so I pipe it through a do() operator in which I do the logging. The problem is, the event ...
2
votes
1answer
52 views

Grouping two different observables of two different classes rxjs

I have two Observables emitting data of 2 different classes : 1.User class : { "id"=>25, "username"=>"Chris", .. other data } 2.UserWebsocket class { "user_id"=>25, "age"=>...
0
votes
1answer
40 views

Angular6 polling not returning data

I have an Angular application where I am trying to check an external data service for changes every few seconds, and update the view. I've tried to implement Polling from rxjs but I'm not able to ...
2
votes
1answer
54 views

ajax request doesn't execute when run test with marble diagrams

I use rxjs v6 and redux-observable v1 I have epic that send request to server and try to test epic like in doc. When I run test epic before send request emit 3 actions and it see on test result, but ...
0
votes
1answer
28 views

How to unsubscribe from Firestore realtime listener which is wrapped in an rxjs observable?

I have written a function that returns an observable that wraps the firestore onSnapshot method. function getObservable() { return Observable.create(observer => { firebase.firestore()....
0
votes
1answer
41 views

Unable to import “of” from rxjs

I am facing a problem with one angular import statement. import { Observable, of } from 'rxjs'; This is what I am trying. But I am not able to import of from rxjs. When I checked the official page ...
0
votes
1answer
16 views

Angular 6: Observable async binding not working as expected after HttpErrorResponse

I'm trying to handle errors in angular globally using an ErrorHandler as layed out here: https://medium.com/@aleixsuau/error-handling-angular-859d529fa53a I'm forwarding the error messages to a ...
0
votes
1answer
14 views

Filtering BehaviourSubject.asObservable() problem

I am loading data through HttpClient and publish them as BehaviourSubject: export interface Car { id:number; make: string; status: number; } In service I am loading data ...
0
votes
1answer
22 views

Pass observable response to next observable after filtering

I am trying to take the response from one observable, filter it, and use that value in the next function call. These are my 3 functions: initTicket(options : ticket = {}, include_client : boolean ) {...