@@ -47,9 +47,11 @@ const getClaudeConfigPath = (client: v1.DockerDesktopClient) => {
47
47
const getClaudeConfig = async ( client : v1 . DockerDesktopClient ) => {
48
48
const path = getClaudeConfigPath ( client )
49
49
const result = await client . docker . cli . exec ( 'run' , [ '--rm' , '--mount' , `type=bind,source="${ path } ",target=/config.json` , 'alpine:latest' , 'sh' , '-c' , `"cat /config.json"` ] )
50
+ localStorage . setItem ( 'claude-config-sync-status-path' , result . stdout )
50
51
return result . stdout
51
52
}
52
53
54
+
53
55
export const setNeverShowAgain = ( value : boolean ) => {
54
56
localStorage . setItem ( 'claude-config-sync-status-never-show-again' , value . toString ( ) )
55
57
}
@@ -66,18 +68,26 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
66
68
const [ configPath , setConfigPath ] = useState < string | null > ( null )
67
69
useEffect ( ( ) => {
68
70
const refreshConfig = async ( ) => {
69
- const config = await getClaudeConfig ( client )
70
- const newConfig = JSON . parse ( config )
71
- setClaudeConfig ( newConfig )
71
+ const cachedConfig = localStorage . getItem ( 'claude-config' )
72
+ try {
73
+ const config = cachedConfig ? JSON . parse ( cachedConfig ) : await getClaudeConfig ( client )
74
+ const newConfig = JSON . parse ( config )
75
+ setClaudeConfig ( newConfig )
76
+ // Dumb cache, no way to see if config changed
77
+ localStorage . setItem ( 'claude-config' , config )
78
+ } catch ( error ) {
79
+ console . error ( 'Error parsing config. Using cached config if available.' , error )
80
+ if ( cachedConfig ) {
81
+ setClaudeConfig ( JSON . parse ( cachedConfig ) )
82
+ }
83
+ }
72
84
}
73
- refreshConfig ( )
74
85
86
+ refreshConfig ( )
75
87
76
88
const interval = setInterval ( ( ) => {
77
89
refreshConfig ( )
78
90
} , 30000 )
79
-
80
-
81
91
return ( ) => {
82
92
clearInterval ( interval )
83
93
}
@@ -103,7 +113,6 @@ export const ClaudeConfigSyncStatus = ({ client, setHasConfig }: { client: v1.Do
103
113
setStatus ( { state : 'missing docker_mcp' , message : 'No Docker servers found in Claude Desktop Config' , color : 'error' } )
104
114
setHasConfig ( false )
105
115
}
106
-
107
116
}
108
117
}
109
118
} , [ claudeConfig ] )
0 commit comments