Refresh the strip and the badge out of band
The "Continue reading" strip and the Updated badge describe the whole library but live outside the #list htmx swaps, so nothing corrected them after a mutation: archiving a series left it sitting in the strip under "Continue reading", with the badge still counting it. A tab switch had the same problem from the other side — the strip was server-gated to All but could not be re-rendered client-side, so /?tab=all reached by htmx and the same URL reloaded produced different DOM. Both regions move into chrome.html and always render, hidden when they have nothing to say, so an out-of-band swap always has an id to target. /ui/list and every mutation append them; the tab the reader is on comes from HX-Current-URL. filter.js keeps only the job the server cannot do — hiding the strip while a filter is active. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,13 +14,13 @@
|
||||
if (!card.hidden) visible++;
|
||||
});
|
||||
|
||||
// The strip is All-only and never filtered. It lives outside #list, so an
|
||||
// htmx tab switch does not re-render it and this is what takes it down;
|
||||
// leaving it up during a search would also put non-matching covers above
|
||||
// an empty list.
|
||||
// The server decides what the strip holds — it ships empty for every tab
|
||||
// but All, and out of band after every mutation. All this has to do is keep
|
||||
// it down while a filter is active, since the strip is never filtered and
|
||||
// would otherwise put non-matching covers above an empty list.
|
||||
var recent = document.querySelector(".recent");
|
||||
if (recent) {
|
||||
recent.hidden = needle !== "" || !document.querySelector('.tabs a.active[href="/?tab=all"]');
|
||||
recent.hidden = needle !== "" || !recent.querySelector(".recent-card");
|
||||
}
|
||||
|
||||
// An empty bucket already explains itself server-side; this only speaks
|
||||
|
||||
Reference in New Issue
Block a user