Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): preserve queries during connection handoff #8311

Closedtris203(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/8311/headopened View on GitHub

Showing 4 changed files with 49 additions and 6 deletions (loading 1).

x
0 of 4 viewed, 4 left
22 additions and 0 deletionspackages/client-runtime/src/connection/registry.test.tsModified
View file
@@ -631,6 +631,28 @@
}),
​
+ it.effect("does not expose a persisted environment as disconnected while it starts", () =>
+ Effect.gen(function* () {
+ const connectionStarted = yield* Deferred.make<void>();
+ const finishConnection = yield* Deferred.make<void>();
+ const harness = yield* makeHarness([TARGET], [], [], {
+ beforeSessionConnect: () =>
+ Deferred.succeed(connectionStarted, undefined).pipe(
+ Effect.andThen(Deferred.await(finishConnection)),
+ ),
+ });
+​
+ yield* Effect.gen(function* () {
+ const registry = yield* EnvironmentRegistry.EnvironmentRegistry;
+ const state = yield* registry.state(TARGET.environmentId);
+​
+ yield* Deferred.await(connectionStarted);
+ expect(state.phase).toBe("connecting");
+ yield* Deferred.succeed(finishConnection, undefined);
+ }).pipe(Effect.provide(harness.layer), Effect.scoped);
+ }),
+ );
+​
it.effect("exposes the current RPC generation to late query subscribers", () =>
Effect.gen(function* () {
const harness = yield* makeHarness([TARGET]);