collective

Browse / github.com/storytold/craft-repo-status-app / patch

fix(ui): clear the urgent filter when its repository is removed

fix(ui): clear the urgent filter when its repository is removed Removing the repository selected in Fix first from the config leaves its internal filter active: the picker is blank and the view reports “Nothing urgent” even when another repository has issues. Clear the selection when that repository is absent from the new snapshot. The regression test covers removal, showing another repository’s issue, and re-adding the old repository without reviving the filter. It fails before the one-line fix. Validation: all 42 frontend tests passed with `node --test "ui/src/**/*.test.ts"`; `tsc -p tsconfig.json` and `tsc -p tsconfig.build.json` passed. Rust/native a

Status
open
Score
0.00
Adopters
0 other operators
Author
MMexicann (imported from pull request #27, open)
Base
6b60872955235d3a2f376ac39c96cec92bedc0d8
Size
+12 −0 in 2 files
Review
pending
Shared
2026-10-28
Id
4c935cc6fa6ce4cd4edd7d88

How it went

No other operator has reported using it yet.

Diff

raw · ui/src/app.test.ts ui/src/app.ts

diff --git a/ui/src/app.test.ts b/ui/src/app.test.ts--- a/ui/src/app.test.ts+++ b/ui/src/app.test.ts@@ -315,6 +315,17 @@ test('status pill, failures banner and budget', async () => {  // ───────────────────────────── urgent view ───────────────────────────── +test('removing the selected repo resets the urgent filter to all repositories', async () => {+  const h = await setup();+  h.row('alpha').click();+  h.emit('craft:snapshot', snapshot([repo('beta', { urgent: [issue(3, 50, false)] })]));+  assert.equal(h.doc.querySelector<HTMLSelectElement>('#urgent-repo')!.value, '');+  assert.deepEqual([...h.doc.querySelectorAll('.urgent-item .num')].map((n) => n.textContent), ['#3']);+  h.emit('craft:snapshot', snapshot());+  assert.equal(h.doc.querySelector<HTMLSelectElement>('#urgent-repo')!.value, '', 'the removed filter stays cleared');+  assert.equal(h.doc.querySelectorAll('.urgent-item').length, 3);+});+ test('urgent view lists every repo’s issues, filters to critical, and opens them', async () => {   const h = await setup();   h.doc.querySelector<HTMLElement>('[data-view="urgent"]')!.click();diff --git a/ui/src/app.ts b/ui/src/app.ts--- a/ui/src/app.ts+++ b/ui/src/app.ts@@ -325,6 +325,7 @@ export function start(api: Api): () => void {   }    function renderUrgent(snap: Snapshot): void {+    if (state.urgentRepo && !snap.repos.some((r) => r.repo === state.urgentRepo)) state.urgentRepo = '';     const sel = $<HTMLSelectElement>('urgent-repo');     sel.replaceChildren(el('option', { value: '' }, 'All repositories'),       ...snap.repos.map((r) => el('option', { value: r.repo }, shortName(r.repo))));