mirror of
https://github.com/re-rxjs/react-rxjs.git
synced 2025-12-08 18:01:51 +00:00
BREAKING CHANGE: suspend, suspended and switchMapSuspended will only emit SUSPENSE if the source doesn't emit synchronously
14 lines
456 B
TypeScript
14 lines
456 B
TypeScript
import { ObservableInput, from, Observable } from "rxjs"
|
|
import { SUSPENSE } from "@react-rxjs/core"
|
|
import { defaultStart } from "./internal-utils"
|
|
|
|
/**
|
|
* A RxJS creation operator that prepends a SUSPENSE on the source observable.
|
|
*
|
|
* @param source$ Source observable
|
|
*/
|
|
export const suspend: <T>(
|
|
source$: ObservableInput<T>,
|
|
) => Observable<T | typeof SUSPENSE> = <T>(source$: ObservableInput<T>) =>
|
|
defaultStart(SUSPENSE)(from(source$)) as any
|