fix(podcasts): library switcher leaked literal "continue" and the podcasts option

The D13 podcast exclusion (9a148c23) was written as a templ
`if !IsBookLibrary(...) { continue }` — but templ markup control flow
has NO continue STATEMENT: codegen emitted the word as a TEXT node
(visible junk between options on every page's library subbar) and
rendered the podcasts option anyway, defeating the exclusion. The real
browser sweep caught what every Go/API test structurally cannot:
generated markup that renders wrong yet compiles clean.

Rewritten as an inverted guard (the idiomatic templ skip). New render
pin TestLibrarySwitcherExcludesPodcasts fails on both halves of the
original leak — the literal text AND the presence of the podcasts
option — so this codegen gotcha class stays tripped-wired.
This commit is contained in:
John O'Keefe committed 2026-10-30 20:50:38 -04:00
1 parent c54430c254
commit 7bf5697c71
3 files changed
+170 -151

No files matched your search

+14 -11
View File
@@ -30,19 +30,22 @@ templ LibrarySwitcher(libData []LibraryData, currentLibraryID string, title stri
// in the book-library switcher — feeds surface via
// /podcasts only. Presentation-layer filter so every
// switcher consumer is correct at once.
if !IsBookLibrary(lib.TypeName) {
continue
}
if lib.Offline {
if lib.ID == currentLibraryID {
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
// (templ markup control flow has NO `continue`
// statement — codegen emits it as literal TEXT and
// renders the option anyway, browser-sweep finding
// 2026-10-30; keep the skip as an inverted guard.)
if IsBookLibrary(lib.TypeName) {
if lib.Offline {
if lib.ID == currentLibraryID {
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
} else {
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
}
} else if lib.ID == currentLibraryID {
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount })</option>
} else {
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount }) — storage offline</option>
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount })</option>
}
} else if lib.ID == currentLibraryID {
<option value={ lib.ID } selected>{ lib.Name } ({ lib.MediaCount })</option>
} else {
<option value={ lib.ID }>{ lib.Name } ({ lib.MediaCount })</option>
}
}
</select>