From a76265a7c0edcae7e1b952cacd32e0eca20b6325 Mon Sep 17 00:00:00 2001 From: Wooseong Kim Date: Mon, 13 Apr 2026 15:05:22 +0900 Subject: [PATCH] fix(image-analysis): wrap defaultDeps in arrow functions to fix circular dep capture Direct function references in defaultDeps (checkRemoteProxy, fetchRemoteAuthStatus, getAuthStatus, getProxyTarget, initializeAccounts) are captured at module load time. Due to circular dependencies in the module graph, auth-handler.js may not have finished initializing when this module is first evaluated, causing these references to be captured as undefined. Wrapping each reference in an arrow function defers evaluation to call time, by which point all modules are fully initialized. isCliproxyRunning was already wrapped correctly; this patch applies the same pattern consistently to all deps. Fixes #973 --- src/utils/hooks/image-analysis-runtime-status.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/utils/hooks/image-analysis-runtime-status.ts b/src/utils/hooks/image-analysis-runtime-status.ts index 4322b9e5..5a4d938e 100644 --- a/src/utils/hooks/image-analysis-runtime-status.ts +++ b/src/utils/hooks/image-analysis-runtime-status.ts @@ -29,11 +29,11 @@ interface ImageAnalysisRuntimeStatusDeps { } const defaultDeps: ImageAnalysisRuntimeStatusDeps = { - checkRemoteProxy, - fetchRemoteAuthStatus, - getAuthStatus, - getProxyTarget, - initializeAccounts, + checkRemoteProxy: (...args) => checkRemoteProxy(...args), + fetchRemoteAuthStatus: (...args) => fetchRemoteAuthStatus(...args), + getAuthStatus: (...args) => getAuthStatus(...args), + getProxyTarget: () => getProxyTarget(), + initializeAccounts: () => initializeAccounts(), isCliproxyRunning: () => isCliproxyRunning(), };