Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): resuming the thread list takes one fewer round trip #21082

Closedunmanbearpig(GitHub profile, opens in a new tab)wants to merge 5 commits intomain fromrefs/pull/21082/headopened View on GitHub

Showing 3 changed files with 6 additions and 2 deletions (loading 2).

x
0 of 3 viewed, 3 left
6 additions and 2 deletionsapps/server/src/rpcInitialItems.tsModified
View file
@@ -1,8 +1,12 @@
import * as Effect from "effect/Effect";
import * as Stream from "effect/Stream";
​
-export function rpcInitialItems<A>(items: ReadonlyArray<A>): Stream.Stream<A> {
- let pending: ReadonlyArray<A> | undefined = items;
+export function rpcInitialItems<A, B = never>(
+ items: ReadonlyArray<A>,
+ completion?: B,
+): Stream.Stream<A | B> {
+ let pending: ReadonlyArray<A | B> | undefined =
+ completion === undefined ? items : [...items, completion];
return Stream.unwrap(
Effect.sync(() => {
const initial = pending;
apps/server/src/ws.test.tsModified
View file
Loading the diff
apps/server/src/ws.tsModified
View file
Loading the diff