The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): local-runtime job poller no longer throws after the test env tears down
teknium19b5f5a0c84ab
diff --git a/apps/desktop/src/app/settings/local-models-settings.test.tsx b/apps/desktop/src/app/settings/local-models-settings.test.tsxindex 5fdee3924b9..237d4b7b77d 100644--- a/apps/desktop/src/app/settings/local-models-settings.test.tsx+++ b/apps/desktop/src/app/settings/local-models-settings.test.tsx@@ -134,6 +134,9 @@ beforeEach(() => {afterEach(() => {cleanup()vi.clearAllMocks()+ // A running job arms the store's 700ms re-poll; drain it so the timer cannot+ // fire into a torn-down test environment.+ $localRuntimeJobs.set([])})describe('LocalModelsSettings', () => {diff --git a/apps/desktop/src/store/local-runtime-jobs.ts b/apps/desktop/src/store/local-runtime-jobs.tsindex 06170cdebc1..dc2ab720bc3 100644--- a/apps/desktop/src/store/local-runtime-jobs.ts+++ b/apps/desktop/src/store/local-runtime-jobs.ts@@ -74,7 +74,7 @@ export async function startLocalRuntimeInstall(): Promise<void> {}const POLL_ACTIVE_MS = 700-let timer: null | number = null+let timer: null | ReturnType<typeof setTimeout> = nulllet polling: Promise<void> | null = nulllet generation = 0interface JobContext {@@ -124,7 +124,7 @@ function resetContext() {const context = ++generationif (timer !== null) {- window.clearTimeout(timer)+ clearTimeout(timer)}timer = null@@ -229,7 +229,7 @@ function poll(): Promise<void> {const accepted = owner.acceptedInstallif (timer !== null) {- window.clearTimeout(timer)+ clearTimeout(timer)}timer = null@@ -263,7 +263,7 @@ function poll(): Promise<void> {polling = nullif (owner.readPending || $localRuntimeJobs.get().some(j => j.status === 'running')) {- timer = window.setTimeout(() => void poll(), POLL_ACTIVE_MS)+ timer = setTimeout(() => void poll(), POLL_ACTIVE_MS)}}}