From 359103f100204729642043b086b5fffa1cc95ee4 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Wed, 29 Jan 2025 09:49:29 +0100 Subject: [PATCH 1/2] Update chromatic extension to not show connection timeout modal twice --- code/package.json | 2 +- code/yarn.lock | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/code/package.json b/code/package.json index 8182756fc2fb..9ee4ec2fa8fa 100644 --- a/code/package.json +++ b/code/package.json @@ -90,7 +90,7 @@ "type-fest": "~2.19" }, "dependencies": { - "@chromatic-com/storybook": "^3.2.2", + "@chromatic-com/storybook": "^3.2.4", "@happy-dom/global-registrator": "^14.12.0", "@nx/eslint": "20.2.2", "@nx/vite": "20.2.2", diff --git a/code/yarn.lock b/code/yarn.lock index fab3a5c2bea9..350d435d7466 100644 --- a/code/yarn.lock +++ b/code/yarn.lock @@ -3256,9 +3256,9 @@ __metadata: languageName: node linkType: hard -"@chromatic-com/storybook@npm:^3.2.2": - version: 3.2.2 - resolution: "@chromatic-com/storybook@npm:3.2.2" +"@chromatic-com/storybook@npm:^3.2.4": + version: 3.2.4 + resolution: "@chromatic-com/storybook@npm:3.2.4" dependencies: chromatic: "npm:^11.15.0" filesize: "npm:^10.0.12" @@ -3267,7 +3267,7 @@ __metadata: strip-ansi: "npm:^7.1.0" peerDependencies: storybook: ^8.2.0 || ^8.3.0-0 || ^8.4.0-0 || ^8.5.0-0 || ^8.6.0-0 - checksum: 10c0/7b8da1ddb399c804337ff28a28594b548392b7bead52f66615b98e201cdeb4d31184b9e355791ba5d0d8cfdd2bea7d38355ecd0058f26f4790f9a887107bde0f + checksum: 10c0/57d466644d859ca58a853cc8316d3b0a64c617216ccf30d743c5fbf24c90859271a5708f05253a3b48c9ce64bc12749dd5a5b00fd1310f5d8a2ee64da9ceebe3 languageName: node linkType: hard @@ -8739,7 +8739,7 @@ __metadata: version: 0.0.0-use.local resolution: "@storybook/root@workspace:." dependencies: - "@chromatic-com/storybook": "npm:^3.2.2" + "@chromatic-com/storybook": "npm:^3.2.4" "@happy-dom/global-registrator": "npm:^14.12.0" "@nx/eslint": "npm:20.2.2" "@nx/vite": "npm:20.2.2" From 7c4bf473bd2109c5f422e4fc7ad619dd15187b52 Mon Sep 17 00:00:00 2001 From: Valentin Palkovic Date: Wed, 29 Jan 2025 09:50:34 +0100 Subject: [PATCH 2/2] Remove the server side check of whether all WS clients are connected --- .../core-server/utils/get-server-channel.ts | 21 +------------------ 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/code/core/src/core-server/utils/get-server-channel.ts b/code/core/src/core-server/utils/get-server-channel.ts index d932836a2d96..3c8370e8955d 100644 --- a/code/core/src/core-server/utils/get-server-channel.ts +++ b/code/core/src/core-server/utils/get-server-channel.ts @@ -17,15 +17,7 @@ export class ServerChannelTransport { private handler?: ChannelHandler; - isAlive = false; - - private heartbeat() { - this.isAlive = true; - } - constructor(server: Server) { - this.heartbeat = this.heartbeat.bind(this); - this.socket = new WebSocketServer({ noServer: true }); server.on('upgrade', (request, socket, head) => { @@ -36,7 +28,6 @@ export class ServerChannelTransport { } }); this.socket.on('connection', (wss) => { - this.isAlive = true; wss.on('message', (raw) => { const data = raw.toString(); const event = @@ -44,21 +35,11 @@ export class ServerChannelTransport { ? parse(data, { allowFunction: false, allowClass: false }) : data; this.handler?.(event); - if (event.type === 'pong') { - this.heartbeat(); - } }); }); const interval = setInterval(() => { - this.socket.clients.forEach((ws) => { - if (this.isAlive === false) { - return ws.terminate(); - } - - this.isAlive = false; - this.send({ type: 'ping' }); - }); + this.send({ type: 'ping' }); }, HEARTBEAT_INTERVAL); this.socket.on('close', function close() {