fix: invalidate plugin detail caches after plugin update#37002
Open
HuTsing wants to merge 3 commits into
Open
Conversation
After updating a plugin, the detail panel (model list, tool list, strategy list) displayed stale data because the corresponding React Query caches were never invalidated. Only the installed plugin list was being refreshed. The delete path already had category-specific invalidation (model providers, tool providers) but the update path did not — this was an oversight introduced during the refactoring in langgenius#31870 and langgenius#33289. This fix centralizes cache invalidation in `handlePluginUpdated` so both update and delete paths properly clear: - Model list cache for model plugins - Tool provider caches for tool plugins - Strategy detail cache for agent-strategy plugins Closes no existing issue — this was unreported. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The useQueryClient hook added in the previous commit requires a QueryClientProvider in the test environment. Mock it to fix CI. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.
Fixes #36999
Summary
After updating a plugin, the detail panel (model list, tool list, strategy list) displays stale data because the corresponding React Query caches are never invalidated. Only the installed plugin list is refreshed.
Root Cause
The
handleDeletepath already had category-specific cache invalidation (refreshModelProviders,invalidateAllToolProviders) buthandlePluginUpdated— used by both marketplace and GitHub update flows — did not. This was an oversight introduced during refactoring in #31870 and #33289.Fix
Centralize cache invalidation in
handlePluginUpdatedso both update and delete paths properly clear:['models', 'model-list']+ global model providers for model plugins['tools', 'builtin-provider-tools']+ all tool providers for tool plugins['strategy', 'detail']for agent-strategy pluginsThis also removes the now-redundant invalidation calls from
handleDelete.Screenshots
Before fix — Plugin updated from 0.0.15 → 0.0.28, but model list still shows 37 models:
After fix — Version updated to 0.0.28, model list refreshes immediately:
Test plan
usePluginOperationspass (with addeduseQueryClientmock)🤖 Generated with Claude Code