Skip to content

Fix resource refresh button not triggering re-fetch#1148

Open
olaservo wants to merge 2 commits intomodelcontextprotocol:mainfrom
olaservo:feature/fix-resource-refresh-button-1120
Open

Fix resource refresh button not triggering re-fetch#1148
olaservo wants to merge 2 commits intomodelcontextprotocol:mainfrom
olaservo:feature/fix-resource-refresh-button-1120

Conversation

@olaservo
Copy link
Copy Markdown
Member

Summary

Fixes #1120

  • The readResource function had an early return when the resource URI was already in resourceContentMap, which prevented the Refresh button from ever re-fetching
  • Added a force parameter to readResource to bypass the cache when the Refresh button is clicked
  • When not forcing, cached content is now properly synced to the display (fixes switching between previously viewed resources showing stale content)

Changes

  • client/src/App.tsx — Added force parameter to readResource; forwarded it through the prop wrapper
  • client/src/components/ResourcesTab.tsx — Updated type signature; Refresh button now passes force=true
  • client/e2e/resource-refresh.spec.ts — New Playwright e2e test verifying the refresh button triggers a new resources/read request

Test plan

  • Existing unit tests pass (npx jest --testPathPattern ResourcesTab — 10/10)
  • TypeScript type-check passes (npx tsc --noEmit)
  • New Playwright e2e test passes (connects to @modelcontextprotocol/server-everything, lists resources, clicks one, clicks Refresh, verifies new resources/read in history)
  • Manual verification: connect to an MCP server, click a resource, click Refresh → new request appears in history
  • Manual verification: click resource A, click resource B, click resource A again → correct cached content displays

🦉 Generated with Claude Code

…ocol#1120)

The readResource function had an early return when the resource URI
was already cached, preventing the Refresh button from re-fetching.
Add a force parameter to bypass the cache on refresh, and update the
cache-hit path to still sync the displayed content when switching
between previously viewed resources.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@olaservo olaservo force-pushed the feature/fix-resource-refresh-button-1120 branch from 234b209 to 70a6b03 Compare April 12, 2026 21:46
@olaservo olaservo marked this pull request as ready for review April 12, 2026 21:48
Failed resource reads were cached in resourceContentMap, causing stale
errors to be served on re-click instead of retrying. Errors now only
set the display content without polluting the cache.

Also renamed the `force` boolean parameter to a `{ bypassCache }` options
object for self-documenting call sites.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@olaservo olaservo force-pushed the feature/fix-resource-refresh-button-1120 branch from c3cd4ef to 3054236 Compare April 12, 2026 22:04
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.

Resource refresh button is not working

1 participant