From 12ef4869e14008def397609bb35804cde80f7499 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 8 Sep 2025 12:34:27 +0200 Subject: [PATCH 1/2] fix(status-bar): invalid status reported when stopping LocalStack externally Fix status bar incorrectly reporting LocalStack as starting when stopping in certain scenarios --- src/utils/localstack-status.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/utils/localstack-status.ts b/src/utils/localstack-status.ts index f89525c..3c5f25a 100644 --- a/src/utils/localstack-status.ts +++ b/src/utils/localstack-status.ts @@ -37,7 +37,7 @@ export async function createLocalStackStatusTracker( }; const deriveStatus = () => { - const newStatus = getLocalStackStatus(containerStatus, healthCheck); + const newStatus = getLocalStackStatus(containerStatus, healthCheck, status); setStatus(newStatus); }; @@ -85,11 +85,15 @@ export async function createLocalStackStatusTracker( function getLocalStackStatus( containerStatus: ContainerStatus | undefined, healthCheck: boolean | undefined, + previousStatus?: LocalStackStatus, ): LocalStackStatus { if (containerStatus === "running") { if (healthCheck === true) { return "running"; } else { + if (previousStatus === "running" || previousStatus === "stopping") { + return "stopping"; + } return "starting"; } } else if (containerStatus === "stopping") { From d601de2a827c76371dd4ab19f8672f26a758024a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cristian=20Pallar=C3=A9s?= Date: Mon, 8 Sep 2025 14:56:35 +0200 Subject: [PATCH 2/2] add explanatory comment --- src/utils/localstack-status.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/utils/localstack-status.ts b/src/utils/localstack-status.ts index 3c5f25a..bfd63a2 100644 --- a/src/utils/localstack-status.ts +++ b/src/utils/localstack-status.ts @@ -91,6 +91,9 @@ function getLocalStackStatus( if (healthCheck === true) { return "running"; } else { + // When the LS container is running, and the health check fails: + // - If the previous status was "running", we are likely stopping LS + // - If the previous status was "stopping", we are still stopping LS if (previousStatus === "running" || previousStatus === "stopping") { return "stopping"; }