fix(history): clear stale methodFilter on clear-all (#1237) (#1247)

When the user clicked Clear in the History screen with a method filter
applied, the filter persisted across the entry reset. Subsequent entries
of a different method then displayed as zero results because the now-
orphaned filter still applied.

Wraps onClearAll at the screen level to also reset methodFilter to
undefined (Option C from the issue) — narrow, no effects, no render-time
divergence between the displayed and applied filter.

Adds a play-driven story exercising the interaction.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Cliff Hall 2026-04-27 15:43:54 -04:00 • committed by GitHub
commit 9f452807f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,4 +1,4 @@
import { useMemo, useState } from "react";
import { useCallback, useMemo, useState } from "react";
import { Card, Flex, Stack } from "@mantine/core";
import type { MessageEntry, MessageMethod } from "@inspector/core/mcp/types.js";
import { HistoryControls } from "../../groups/HistoryControls/HistoryControls";
@ -47,6 +47,11 @@ export function HistoryScreen({
[entries],
);
const handleClearAll = useCallback(() => {
setMethodFilter(undefined);
onClearAll();
}, [onClearAll]);
return (
<ScreenLayout>
<Sidebar>
@ -65,7 +70,7 @@ export function HistoryScreen({
pinnedIds={pinnedIds}
searchText={searchText}
methodFilter={methodFilter}
onClearAll={onClearAll}
onClearAll={handleClearAll}
onExport={onExport}
onReplay={onReplay}
onTogglePin={onTogglePin}