Questions tagged rxjs6

Explore the latest questions and answers asked by our top developers.

Angular 12/rxjs 7/angularfire: async token interceptor with deprecated toPromise

I am using angularfire with and auth interceptor adding a token to every request. This interceptor requires an async call as the token might requires a refresh. With an update to rxjs 7, my async tokenHandler now faces two issues: the .toPromise() is depcrated the async tokenHandler may returns undefined (Type ‘HttpEvent | undefined’ is […]

By Tea2k
Published
Categorized as angular, angularfire, firebase, rxjs, rxjs6 Tagged , , , ,

Angular async pipe reduces stream value rather than displays latest emission

My useage of mergeMap seems to reduce the boolean stream down to one value, because <button [disabled]="!(canRequestPricing$ | async)" canRequestPricing$ | async should be true, but if the first emission is false, it is false. public canRequestPricing$ = new BehaviorSubject<boolean>(false); public ngOnInit(): void { this.canRequestPricingSubscription = this.canRequestPricing$.pipe( mergeMap(() => this.mappedItem.canRequestPricing()), take(1), mergeMap((canRequestPricingFromApi) => { const […]

By BeniaminoBaggins
Published
Categorized as angular, angular-pipe, rxjs6 Tagged , ,

rxjs operators for combine response

I have below existing nested subscriptions (angular 6 project ) of streams but it depends upon the first observables response wherein it loads action from the store and then fires two subscriptions from store. this.store.pipe(select(getOrganizationDetails), takeWhile(() => this.componentActive)) .subscribe(resOrganization => { if (resOrganization) { this.organization = resOrganization; this.store.dispatch(new mangeIconsActions.LoadIcons(this.organization.id)); this.store.pipe(select(fromManageIcons.getContentIcons),takeWhile(()=>this.componentActive)).subscribe(contentIcons=>{ this.contentIcons=contentIcons; }); //loading module Icons […]

By user5769212
Published
Categorized as angular, rxjs6 Tagged ,

rxjs operators for combining observable streams but depends on first observable response

I have below existing nested subscriptions (angular 6 project ) of streams but it depends upon the first observables response wherein it loads action from the store and then fires two subscriptions from store. this.store.pipe(select(getOrganizationDetails), takeWhile(() => this.componentActive)) .subscribe(resOrganization => { if (resOrganization) { this.organization = resOrganization; this.store.dispatch(new mangeIconsActions.LoadIcons(this.organization.id)); this.store.pipe(select(fromManageIcons.getContentIcons),takeWhile(()=>this.componentActive)).subscribe(contentIcons=>{ this.contentIcons=contentIcons; }); //loading module Icons […]

By user5769212
Published
Categorized as angular, rxjs6 Tagged ,

getting "Cannot find module ‘rxjs-compat/Observable’" but only code requiring it is RXjs itself

error I am getting in console when running an ‘ng serve’: module.js:550 throw err; ^ Error: Cannot find module ‘rxjs-compat/Observable’ at Function.Module._resolveFilename (module.js:548:15) at Function.Module._load (module.js:475:25) at Module.require (module.js:597:17) at require (internal/module.js:11:18) at Object.<anonymous> (C:Users[USR]sourcerepos[ProprietaryApp]webnode_modulesrxjsObservable.js:6:10) at Module._compile (module.js:653:30) at Object.Module._extensions..js (module.js:664:10) at Module.load (module.js:566:32) at tryModuleLoad (module.js:506:12) at Function.Module._load (module.js:498:3) Problem: All of my code […]

By AJLocke
Published
Categorized as angular, node.js, npm, rxjs, rxjs6 Tagged , , , ,

RxJs: how to maintain one WebSocket connection across multiple components?

I have a chat application that consists of multiple components (e.g. one components holds a group list, another one contains messages, etc.), and when one component is opened another one must be closed. So here is a service that I’m using to provide a webSocket connection: @Injectable() export class ChatConnectionService { private _connection: Subject<any>; constructor(private […]

By Lunin Roman
Published
Categorized as angular, rxjs, rxjs6, websocket Tagged , , ,

Angular Rxjs: Write custom operator to replace shareReplay() with my own business logic

First of all thank you for your time. I would like to get a nudge into the right direction regarding making my own custom Rxjs operator that results into the same as shareReplay() except when I want it to update. Basically we have a session storage variable which sets the users organization AND a JWT […]

By sdev95
Published
Categorized as angular, rxjs, rxjs-observables, rxjs6 Tagged , , ,

Angular 9 service nested http requests

I need to do a query to 2 separate endpoints to provide the objects needed for my component. No Endpoint Response 1 /registry/colors {"colors":["red","green","blue","orange"]} 2 /color/{colorName} {"name":"red", "details":["detail1","detail2", "detail3"]} For each color in the colors array, I need to call the color details endpoint and collect all of those color details into an array of […]

By Joel
Published
Categorized as angular, rxjs, rxjs6 Tagged , ,

Angular 11 – RxJs concat for AWS S3 Multipart File Upload does not wait for request to complete

I am implementing the multipart upload set of APIs from the AWS S3 SDK to handle large file uploads. According to the SDK documentation, the multipart upload needs to be explicitly closed after all part have been uploaded. This closure API call – completeMultipartUpload, requires a map of the chunks which is a mapping of […]

By codeDabbling
Published
Categorized as amazon-s3, angular, aws-sdk-js, rxjs, rxjs6 Tagged , , , ,

Subscrition fired twice when page loads Angular

I have a behavior subject that is updated upon service call response. I update it using setter. readonly userList$ = new BehaviorSubject<User[]>(null); get users() { return this.user$.getValue(); } set users(data:any[]) { this.user$.next(data); } I have two pages public-data-list and a users page. when I select a record from public-data-page. it goes to the user page. […]

By NicoleZ
Published
Categorized as angular, rxjs, rxjs-observables, rxjs6 Tagged , , ,
1 8

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq