Open History to see the last commit
1import * as Effect from "effect/Effect";
2import * as Stream from "effect/Stream";
3
4export function rpcInitialItems<A>(items: ReadonlyArray<A>): Stream.Stream<A> {
5 let pending: ReadonlyArray<A> | undefined = items;
6 return Stream.unwrap(
7 Effect.sync(() => {
8 const initial = pending;
9 // concat keeps its initial stream definition alive during the live tail.
10 // That definition must no longer own delivered snapshots or replay rows.
11 pending = undefined;
12 return initial === undefined ? Stream.empty : Stream.fromIterable(initial);
13 }),
14 );
15}