Skip to content
Source
Sign inSign up
pingdotgg/t3code

Skip healthy env reconnects after browser resume #2677

Mergedjuliusmarmingemerged 2 commits intomain fromrefs/pull/2677/headmerged by juliusmarminge View on GitHub

Showing 3 changed files with 59 additions and 2 deletions.

x
0 of 3 viewed, 3 left
53 additions and 1 deletionapps/web/src/environments/runtime/service.threadSubscriptions.test.tsModified
View file
@@ -176,6 +176,7 @@
})),
+ isHeartbeatFresh: vi.fn(() => true),
orchestration: {
subscribeThread: mockSubscribeThread,
@@ -382,7 +383,7 @@
await resetEnvironmentServiceForTests();
});
​
- it("reconnects environment streams when the browser resumes from the background", async () => {
+ it("keeps healthy environment streams connected when the browser resumes from the background", async () => {
let visibilityState: DocumentVisibilityState = "visible";
const documentTarget = new EventTarget();
const windowTarget = new EventTarget();
@@ -408,6 +409,57 @@
documentTarget.dispatchEvent(new Event("visibilitychange"));
expect(mockConnectionReconnects[0]).not.toHaveBeenCalled();
​
+ visibilityState = "visible";
+ documentTarget.dispatchEvent(new Event("visibilitychange"));
+ expect(mockConnectionReconnects[0]).not.toHaveBeenCalled();
+​
+ stop();
+ await resetEnvironmentServiceForTests();
+ });