fix(cliproxy): make version cache backend-specific for proper switching

- Add backend parameter to version cache functions (read/write/path)
- Store cache at bin/{backend}/.version-cache.json instead of shared location
- Pass backend through checkForUpdates() and BinaryManager
- Add refetchType: 'all' to force immediate query refetch on backend change
- Add cliproxy-server-config query invalidation for consistency
This commit is contained in:
kaitranntt committed 2026-01-23 14:40:40 -05:00
1 parent 0511c5e2fd
commit a41fd2a093
4 files changed
+34 -17

No files matched your search

+4 -2
View File
@@ -353,8 +353,10 @@ export function useUpdateBackend() {
api.cliproxyServer.updateBackend(backend, force),
onSuccess: () => {
// Invalidate all queries that depend on backend setting
queryClient.invalidateQueries({ queryKey: ['cliproxy-update-check'] });
queryClient.invalidateQueries({ queryKey: ['cliproxy-versions'] });
// Use refetchType: 'all' to force immediate refetch even if query is stale
queryClient.invalidateQueries({ queryKey: ['cliproxy-update-check'], refetchType: 'all' });
queryClient.invalidateQueries({ queryKey: ['cliproxy-versions'], refetchType: 'all' });
queryClient.invalidateQueries({ queryKey: ['cliproxy-server-config'], refetchType: 'all' });
queryClient.invalidateQueries({ queryKey: ['proxy-status'] });
queryClient.invalidateQueries({ queryKey: ['cliproxy-stats'] });
toast.success('Backend updated');