Skip to content

Commit 4fc0682

Browse files
v6: Add an empty state to the History panel (#4418)
## Summary The History panel had no empty state. With no run history and no favorites (first run, or right after "Clear"), it rendered only its header and nothing below, just blank space. Add a "No queries run yet." message for that case, styled to match the Collections panel's existing empty state. ## Test plan - [x] Open a fresh GraphiQL instance with no query history. Open the History panel and confirm it shows a "No queries run yet." message below the header instead of blank space. - [x] Run a query. Reopen the History panel and confirm the empty-state message is gone, replaced by the new history entry. - [x] Click "Clear" to remove all history and favorites. Confirm the empty-state message reappears. - [x] Favorite an item, then delete the remaining regular history so only the favorite is left. Confirm the empty-state message stays hidden (favorites alone should not trigger it). - [x] Check both Dark and Light themes. The empty-state text should be legible and match Collections' muted styling in each. Refs: #4219
1 parent 7123fd6 commit 4fc0682

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

packages/graphiql-plugin-history/src/components.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ export const History: FC = () => {
5454
actions={clearButton}
5555
/>
5656

57+
{!hasFavorites && !hasItems && (
58+
<div className="graphiql-history-empty">No queries run yet.</div>
59+
)}
60+
5761
{hasFavorites && (
5862
<ul className="graphiql-history-items">
5963
{favorites.map(item => (

packages/graphiql-plugin-history/src/style.css

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
flex: 1;
1414
}
1515

16+
.graphiql-history-empty {
17+
padding: var(--px-8) var(--px-12);
18+
color: oklch(var(--fg-subtle));
19+
font-size: var(--font-size-hint);
20+
}
21+
1622
.graphiql-history-item {
1723
border-bottom: 1px solid oklch(var(--border-default));
1824
display: flex;

0 commit comments

Comments
 (0)