Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): connect to the primary environment while the browser reports offline #29347

Mergedjuliusmarmingemerged 7 commits intomain fromrefs/pull/29347/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 96 additions and 8 deletions.

x
0 of 2 viewed, 2 left
73 additions and 2 deletionspackages/client-runtime/src/connection/supervisor.test.tsModified
View file
@@ -324,7 +324,7 @@
it.effect("waits while offline and connects immediately when the network returns", () =>
Effect.gen(function* () {
const harness = yield* makeHarness({ networkStatus: "offline" });
- const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, {
+ const supervisor = yield* EnvironmentSupervisor.make(RELAY_ENTRY, {
initiallyDesired: true,
}).pipe(Effect.provide(harness.dependencies));
​
@@ -346,6 +346,54 @@
}),
​
+ it.effect("connects to the primary environment while the device reports offline", () =>
+ Effect.gen(function* () {
+ const harness = yield* makeHarness({ networkStatus: "offline" });
+ const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, {
+ initiallyDesired: true,
+ }).pipe(Effect.provide(harness.dependencies));
+​
+ const settled = yield* awaitState(
+ supervisor.state,
+ (state) => state.phase === "connected" || state.phase === "offline",
+ );
+​
+ expect(settled).toMatchObject({
+ phase: "connected",
+ network: "unknown",
+ attempt: 1,