Skip to content

fix(app): invalidate provider queries after config update to show custom providers immediately#28313

Merged
Brendonovich merged 2 commits into
anomalyco:devfrom
tianxiaoliang:fix-custom-provider-list-refresh
May 19, 2026
Merged

fix(app): invalidate provider queries after config update to show custom providers immediately#28313
Brendonovich merged 2 commits into
anomalyco:devfrom
tianxiaoliang:fix-custom-provider-list-refresh

Conversation

@tianxiaoliang
Copy link
Copy Markdown
Contributor

@tianxiaoliang tianxiaoliang commented May 19, 2026

Issue for this PR

Closes #24818

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Fixes the issue where custom providers configured in Desktop settings do not appear in the model selection list until the app is restarted.

The root cause: updateConfigMutation.onSuccess in global-sync.tsx only called bootstrap.refetch(), which refreshes global provider data but does not invalidate per-directory provider queries cached in child-store.ts. Each project directory maintains its own provider list with queryKey [directory, "providers"], so these stayed stale after config update.

The fix adds queryClient.invalidateQueries() calls to clear both global and per-directory provider caches after a successful config update, so the newly added custom provider shows up immediately.

How did you verify your code works?

The change targets the query cache invalidation path. invalidateQueries is the standard TanStack Query API for this purpose - when the provider config is updated, invalidating all [*, "providers"] queries forces a refetch on next access, which will include the newly configured custom provider.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…tom providers immediately

When users configure a custom provider via the Desktop UI, the newly added
provider does not appear in the available provider list until the app is
restarted. This happens because updateConfigMutation's onSuccess only calls
bootstrap.refetch(), which does not invalidate per-directory provider queries
in child stores.

This fix adds queryClient.invalidateQueries() calls to clear all provider
caches (both global and per-directory) after a successful config update,
ensuring custom providers appear immediately in the model selection list.

Fixes anomalyco#24818
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@Brendonovich Brendonovich merged commit 2932a7a into anomalyco:dev May 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OpenCode Desktop Beta Feedback

2 participants