K
K
Konstantin2020-11-01 16:22:42
Angular
Konstantin, 2020-11-01 16:22:42

RangeError: Maximum call stack size exceeded in Observable?

Function in component:

public delete(event: IEvent): void {
    this.confirm
      .open({})
      .pipe(
        filter(Boolean),
        concatMap(() => this.eventService.delete(event))
      )
      .subscribe((response) => this.eventService.next(response));
  }


Service:
public next(events: IEvent[]): void {
    this.events$.next(events);
  }

  public events(): Observable<any> {
    return this.events$.asObservable();
  }

  public delete(event: IEvent): Observable<any> {
    return this.eventsService
      .delete(event)
      .pipe(
        concatMap(() =>
          this.events$.pipe(
            map((events: IEvent[]) =>
              events.filter((e) => e.idEvent !== event.idEvent)
            )
          )
        )
      );
  }


Why after calling the delete function from the component - I get an error:

core.js:4002 ERROR RangeError: Maximum call stack size exceeded
    at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:200)
    at

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question