fix: persist provider display state across restarts (fixes #624) (#633)

Co-authored-by: Kagura Chen <daniyuu19@sjtu.edu.cn>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Kagura
2026-03-23 16:59:41 +08:00
committed by GitHub
parent 7643cb8a75
commit 884aa7c7f1
3 changed files with 130 additions and 2 deletions

View File

@@ -30,8 +30,9 @@ interface ProviderState {
defaultAccountId: string | null;
loading: boolean;
error: string | null;
// Actions
init: () => Promise<void>;
refreshProviderSnapshot: () => Promise<void>;
createAccount: (account: ProviderAccount, apiKey?: string) => Promise<void>;
removeAccount: (accountId: string) => Promise<void>;
@@ -74,7 +75,11 @@ export const useProviderStore = create<ProviderState>((set, get) => ({
defaultAccountId: null,
loading: false,
error: null,
init: async () => {
await get().refreshProviderSnapshot();
},
refreshProviderSnapshot: async () => {
set({ loading: true, error: null });