Skip to content
Discussion options

You must be logged in to vote

Yes, that is by design and it's the expected behavior.

You could compose some of the existing operators to build a custom operator that behaves like that, though.

For instance:

import {
  switchMap,
  ObservableInput,
  concat,
  of,
  pipe,
  takeWhile,
  OperatorFunction,
} from "rxjs"

// Notice that `DONE` is an implementation detail, meaning that the
// consumers of the custom operator wouldn't know about its existence,
const DONE = Symbol("DONE")
const emitDoneOnComplete = <T>(source: ObservableInput<T>) =>
  concat(source, of(DONE))

export const switchMapUntilInnerCompletes = <I, O>(
  project: (value: I) => ObservableInput<O>,
): OperatorFunction<I, O> =>
  pipe(
    switchMap(pipe(

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@josepot
Comment options

@artfulsage
Comment options

@josepot
Comment options

@artfulsage
Comment options

@josepot
Comment options

Answer selected by artfulsage
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants