fix(app): invalidate provider queries after config update to show custom providers immediately#28313
Merged
Brendonovich merged 2 commits intoMay 19, 2026
Conversation
…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
Contributor
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #24818
Type of change
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.onSuccessinglobal-sync.tsxonly calledbootstrap.refetch(), which refreshes global provider data but does not invalidate per-directory provider queries cached inchild-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.
invalidateQueriesis 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