Skip to content

feat(studio): a badge for changes that are not live yet - #78

Merged
Madraka merged 1 commit into
mainfrom
feat/studio-unpublished-badge
Oct 22, 2026
Merged

Madraka merged 1 commit into
mainfrom
feat/studio-unpublished-badge

Conversation

@Madraka

@Madraka Madraka commented Oct 22, 2026

Copy link
Copy Markdown
Contributor

Beside Studio's Publish button: how many changes are not live yet, and of what kind.

API: GET /api/sites/:siteId/pending

  • site:read, no-store. Answers { live, liveSnapshotId?, counts: { added, changed, removed, total }, byKind }.
  • Built on store.pendingChanges (what a publish would take: releases' held nodes stay live, and the site node's publish pointer is ignored).
  • Adding or deleting a page also rewrites Site.pageIds, so that site change is not counted twice ("add a page" = 1 page + 0 site). A reorder or a settings edit still counts.
  • Never published: live: false, and everything counts as added.
  • Shared suite on sqlite and D1: 401/404; never published; nothing pending after a publish; an entry edit = 1; an added page counted once.

Studio

  • PendingBadge in SitePublish: a Kumo Badge dot with "2 changes", or "Not published" before the first publish; number-only on phones. The tooltip reads e.g. "3 changes aren't live yet · 2 articles and 1 page" (ICU select + plural).
  • The count is in the Publish button's accessible name.
  • Freshness: one query (["pending", siteId], 30 s stale, refetch on focus), invalidated by a central onApiWrite hook in the API client after any successful write under /api/sites/<site> (except previews). The Build chat's streamed fetch signals it too. Agent changes over MCP show on the next focus or within 30 s.
  • i18n: English plus drafts for 18 languages, including Turkish, which is marked reviewed (please review its new strings).

Bundle

Initial gzip 415.9 → 416.6 kB (budget 420).

Checks (one package at a time)

Package Tests
api 381/381
Studio 1186/1186 (new pending-changes.test.tsx: count, plurals, not published, no badge, refetch after a write but not after a preview or another site)

Also passing: typecheck, design lint (350 files), and the size ratchet. Screenshots at 1440 and 390 px passed: "● 2 changes" sits at control height between View site and Publish, and shows "● 2" on phones.

🤖 Generated with Claude Code

- API `GET /api/sites/:siteId/pending` (site:read, no-store): counts of
  what a publish would add, change and remove (`pendingChanges`), by kind;
  a site node that differs only by the added or removed page ids is not
  counted twice. Never published: `live: false`, everything added.
- Studio: a dot Badge beside Publish ("2 changes", "Not published"),
  number-only on phones, with a pluralised tooltip by kind; the count is
  in the Publish button's accessible name. One query, refreshed after any
  write to the site through the API client (`onApiWrite`), on focus and
  every 30 s.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: Madraka <[email protected]>
@Madraka
Madraka merged commit b15b9fe into main Oct 22, 2026
4 checks passed
@Madraka
Madraka deleted the feat/studio-unpublished-badge branch October 22, 2026 11:11
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.

1 participant