fix(web): hide resource subscription UI when server lacks subscribe capability - #1479
Conversation
…apability (#1478) Thread a `subscriptionsSupported` flag derived from `capabilities?.resources?.subscribe === true` from App through InspectorView → ResourcesScreen to the leaf components. When false: - ResourcePreviewPanel hides the Subscribe/Unsubscribe button (Refresh stays). - ResourceControls omits the Subscriptions accordion section entirely, dropping it from `allSections` so the expand/collapse-all toggle and open-section bookkeeping stay correct even if a stale "subscriptions" entry persists from a prior subscription-capable session. The flag defaults to true at the leaf components so existing callers, tests, and stories keep rendering the subscription controls unless a server is explicitly marked unsupported. Adds unit tests and Storybook stories covering the hidden and shown states across all three components. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…treatment (#1474) The server grid's ScrollArea.Autosize used the default type="hover" with no offsetScrollbars, so the scrollbar popped in on hover and overlaid the right edge of the server cards (occluding their action icons / status badges) — the same problem #1474 fixed for the History/Network/Logging list panels. Apply the same `type="scroll"` + `offsetScrollbars` treatment, and reuse the shared `expectScrollbarGutterIdleHidden` story assertion to regression-protect the gutter + idle-hidden behavior. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
AppShell.Main carried Mantine's default `padding="md"` on top of the fixed-header offset, but every screen already sizes itself to `calc(100vh - header)` and supplies its own `xl` padding (with no allowance for Main's padding). That extra inset pushed screen content past the viewport, so the whole InspectorView gained a page-level scrollbar instead of confining overflow to each screen's inner ScrollArea. Set the shell `padding` to 0 (Main now contributes only the header offset, matching what the screens were built for) and clamp the Main slot to `height: 100dvh` with `overflow: hidden` in the theme, so the view can never scroll regardless of content — only the inner ScrollArea regions do. Adds an InspectorView story play assertion guarding the invariant (Main clips + is viewport-clamped) and a ManyServers fixture that confirms it holds under enough content to overflow, with the inner server-grid ScrollArea absorbing the overflow. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @cliffhall's task in 1m 46s —— View job Code Review
Overall this is a clean, well-scoped PR. The capability-gating follows the established ✅ Subscription gating — looks correct
🟡 Minor: stale
|
…tions intent Responding to the @claude review on #1479: - Align all screen height calcs from `100vh` to `100dvh` so they match the Main slot's `100dvh` clamp. On a mobile viewport where `dvh < vh` a `100vh` child would have exceeded Main's `100dvh` content box and been clipped by `overflow: hidden`; the units are now in lockstep. - Restrict `intendedButEmptySections` in ResourceControls to `allSections` so a stale "subscriptions" entry persisted from a prior subscription-capable session is dropped from persisted open-sections instead of being perpetually re-appended once the section is no longer rendered. Adds a regression test. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Thanks for the review! Addressed in 21b13ff: 🟡 🟡 Stale 🟡
|
|
@claude review |
|
Claude finished @cliffhall's task in 53s —— View job Code Review (round 2)
Both follow-ups from the previous review are addressed cleanly, and the rest of the PR is unchanged from the already-approved round. No blocking issues — this looks ready to merge. ✅ ✅ Viewport unit alignment (
|
Closes #1478
Summary
On the Resources screen, the Subscribe/Unsubscribe button and the Subscriptions accordion section were always rendered, even when the connected server doesn't advertise the
resources.subscribecapability — controls that can't do anything useful for such servers.This threads a
subscriptionsSupportedflag, derived inApp.tsxfromcapabilities?.resources?.subscribe === true, throughInspectorView→ResourcesScreento the leaf components (matching the existingcompletionsSupportedpattern). When the server doesn't support subscriptions:ResourcePreviewPanelhides the Subscribe/Unsubscribe button (Refresh stays).ResourceControlsomits the Subscriptions accordion section entirely — dropping it fromallSectionsso the expand/collapse-all toggle and open-section bookkeeping stay correct even if a stale"subscriptions"entry persists from a prior subscription-capable session.The flag defaults to
trueat the leaf components, so existing callers, tests, and stories keep rendering the subscription controls unless a server is explicitly marked unsupported.Testing
ResourceControls,ResourcePreviewPanel, andResourcesScreen.SubscriptionsUnsupportedstories (with play assertions where applicable) for all three components.npm run validate✅ andnpm run test:storybook✅ (360 stories).🤖 Generated with Claude Code
Also in this PR: Servers screen scrollbar treatment (follow-up to #1474)
The Servers screen grid had the same scrollbar issue #1474 fixed for the History/Network/Logging list panels: the
ScrollArea.Autosizeused the defaulttype="hover"with nooffsetScrollbars, so the bar popped in on hover and overlaid the right edge of the server cards (occluding their action icons / status badges).Applied the same
type="scroll"+offsetScrollbarstreatment toServerListScreen, and reused the sharedexpectScrollbarGutterIdleHiddenstory assertion to regression-protect the gutter + idle-hidden behavior.Also in this PR: InspectorView shell no longer scrolls as a whole
The entire InspectorView could gain a page-level scrollbar (see the reported screenshot):
AppShell.Maincarried Mantine's defaultpadding="md"on top of the fixed-header offset, but every screen already sizes itself tocalc(100vh - header)with its ownxlpadding (no allowance for Main's padding). That extra inset pushed screen content past the viewport, so the page scrolled instead of confining overflow to each screen's inner ScrollArea.Fix: set the shell
paddingto0(Main now contributes only the header offset, matching what the screens were built for) and clamp the Main slot toheight: 100dvh+overflow: hiddenin the theme — so the view can never scroll regardless of content; only the inner ScrollArea regions do. Added an InspectorView story play assertion guarding the invariant (verified it fails without the fix) plus aManyServersfixture confirming it holds under overflow-inducing content.