Skip to content

Fix resource refresh button not triggering re-fetch#1148

Draft
olaservo wants to merge 1 commit intomodelcontextprotocol:mainfrom
olaservo:feature/fix-resource-refresh-button-1120
Draft

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

Conversation

@olaservo
Copy link
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>
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