feat(feed): reshuffle button for the "surprise me" sort

The backend shuffle sort already accepts a seed param. Add a circular
reshuffle button next to the sort control (shown only when shuffle is
active) that re-rolls the seed and re-queries the feed; selecting shuffle
also seeds a fresh order instead of the deterministic seed-0 one. The seed
lives in FeedFilters but is intentionally kept out of the URL state.
This commit is contained in:
npeter83 2026-06-15 03:08:10 +02:00
parent b325893b22
commit 5a96607557
5 changed files with 43 additions and 11 deletions

View file

@ -73,6 +73,9 @@ export interface FeedFilters {
tagMode: "or" | "and";
q: string;
sort: string;
// Re-roll token for the "shuffle" sort; bumped by the reshuffle button so the
// feed re-queries with a fresh order. Ignored by every other sort.
seed?: number;
includeNormal: boolean;
includeShorts: boolean;
includeLive: boolean;
@ -153,6 +156,7 @@ function feedQuery(f: FeedFilters, offset: number, limit: number): string {
p.set("tag_mode", f.tagMode);
if (f.q) p.set("q", f.q);
p.set("sort", f.sort);
if (f.sort === "shuffle" && f.seed) p.set("seed", String(f.seed));
p.set("show_normal", String(f.includeNormal));
p.set("include_shorts", String(f.includeShorts));
p.set("include_live", String(f.includeLive));