Skip to content

Until operator error - dispose of signal #428

Description

@moczix

consider this example:

export class AppComponent {
  
  private _destroy$ = new MostStream<void>();

  private example$ = new MostStream<void>();


  private example1$: Stream<any> = R.piped(
    this.example$,
    tap(d => console.log('test', d)),
    until(this._destroy$)
  )

  start() {
    console.log('start');
    runEffects(tap(d => console.log('got 1', d), this.example1$), newDefaultScheduler());
    runEffects(tap(d => console.log('got 2', d), this.example1$), newDefaultScheduler());
  }

  end() {
    console.log('end');
    this._destroy$.add(null);
  }

  push() {
    console.log('push')
    this.example$.add(null);
  }

}

MostStream is my implementation of streams for your lib. Click on start, then click on push and then on end. What happend? only first runEffects will be ended due to until operator.
why? because of this:

    const d1 = this.source.run(sink, scheduler)
    const d2 = this.maxSignal.run(new UntilSink(sink, disposable), scheduler)
    disposable.setDisposable(disposeBoth(d1, d2))

you dispose both, source and signal. Is it bug? or feature?
in rxjs only the source is disposed

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions