Skip to content

fix: invalidate plugin detail caches after plugin update#37002

Open
HuTsing wants to merge 3 commits into
langgenius:mainfrom
HuTsing:fix/plugin-update-model-list-refresh
Open

fix: invalidate plugin detail caches after plugin update#37002
HuTsing wants to merge 3 commits into
langgenius:mainfrom
HuTsing:fix/plugin-update-model-list-refresh

Conversation

@HuTsing
Copy link
Copy Markdown

@HuTsing HuTsing commented Jun 3, 2026

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.

  • Model plugins: model list still shows old models after update
  • Tool plugins: tool list doesn't reflect newly added/removed tools
  • Agent-strategy plugins: strategy list remains stale

Root Cause

The handleDelete path already had category-specific cache invalidation (refreshModelProviders, invalidateAllToolProviders) but handlePluginUpdated — 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 handlePluginUpdated so 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 plugins

This 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:

before-update

After fix — Version updated to 0.0.28, model list refreshes immediately:

after-update

Test plan

  • Existing unit tests for usePluginOperations pass (with added useQueryClient mock)
  • Update a model plugin (e.g. ZHIPU AI) → verify model list refreshes immediately
  • Update a tool plugin → verify tool list refreshes
  • Update an agent-strategy plugin → verify strategy list refreshes
  • Delete a plugin → verify behavior unchanged (no regression)

🤖 Generated with Claude Code

HuTsing and others added 3 commits May 26, 2026 12:53
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>
@HuTsing HuTsing requested review from iamjoel and zhsama as code owners June 3, 2026 08:34
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Jun 3, 2026
@github-actions github-actions Bot added the web This relates to changes on the web. label Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S This PR changes 10-29 lines, ignoring generated files. web This relates to changes on the web.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: Plugin detail panel shows stale model/tool/strategy list after plugin update

1 participant