From 184de87e91c97589a6f10babb92b17f3d84c88d7 Mon Sep 17 00:00:00 2001 From: Julius Marminge Date: Thu, 9 Apr 2026 19:46:46 -0700 Subject: [PATCH] Reset client settings persistence in test teardown - add a test-only reset helper for cached settings state - clear client settings persistence when resetting the local API --- apps/web/src/hooks/useSettings.ts | 7 +++++++ apps/web/src/localApi.ts | 2 ++ 2 files changed, 9 insertions(+) diff --git a/apps/web/src/hooks/useSettings.ts b/apps/web/src/hooks/useSettings.ts index 3fec075b06..3dc2cf9b20 100644 --- a/apps/web/src/hooks/useSettings.ts +++ b/apps/web/src/hooks/useSettings.ts @@ -177,3 +177,10 @@ export function useUpdateSettings() { resetSettings, }; } + +export function __resetClientSettingsPersistenceForTests(): void { + clientSettingsSnapshot = DEFAULT_CLIENT_SETTINGS; + clientSettingsHydrated = false; + clientSettingsHydrationPromise = null; + clientSettingsListeners.clear(); +} diff --git a/apps/web/src/localApi.ts b/apps/web/src/localApi.ts index 8fe17f4a89..40ed014580 100644 --- a/apps/web/src/localApi.ts +++ b/apps/web/src/localApi.ts @@ -142,6 +142,8 @@ export function ensureLocalApi(): LocalApi { export async function __resetLocalApiForTests() { cachedApi = undefined; + const { __resetClientSettingsPersistenceForTests } = await import("./hooks/useSettings"); + __resetClientSettingsPersistenceForTests(); await resetEnvironmentServiceForTests(); resetGitStatusStateForTests(); resetRequestLatencyStateForTests();