fix: refresh provider cache from live config
OpenChamber could show stale providers in Settings after users changed opencode.json because provider lists were restored from the persisted config-store cache. OpenCode itself was already correct, but the UI could keep showing old providers across app or machine restarts. Stop persisting provider lists/defaults, strip old persisted provider snapshots during hydration, and invalidate provider cache before startup/config reload fetches. Provider config changes now refresh all known project directories immediately with capped concurrency, so switching projects later uses fresh cached data instead of triggering a refetch on navigation. Also validate the selected provider/model after every provider reload, fall back to a live valid model when the old one was removed, and preserve a still-valid current model variant. Add regression coverage for hydration stripping, multi-directory provider refresh, and variant preservation.
This commit is contained in:
@@ -630,6 +630,7 @@ async function performConfigRefresh(options: {
|
||||
|
||||
if (refreshProviders) {
|
||||
useConfigStore.getState().invalidateModelMetadataCache();
|
||||
useConfigStore.getState().invalidateProviderCache(mode === "active" ? currentDirectory : undefined);
|
||||
}
|
||||
|
||||
const sdkRefreshTasks: Promise<void>[] = [];
|
||||
|
||||
Reference in New Issue
Block a user