From a528e2c3665aa22caa92e19e202d7be6a85a9084 Mon Sep 17 00:00:00 2001 From: npeter83 Date: Mon, 29 Jun 2026 02:30:37 +0200 Subject: [PATCH] fix(search): include Library source filter in shareable URL The new library_source provenance filter wasn't serialised into the Share-view URL, so a copied link lost the 'search results only' (or 'include search') selection. Add it as the 'source' param (emitted only in 'all' scope, omitted for the default 'organic'). --- frontend/src/lib/urlState.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/lib/urlState.ts b/frontend/src/lib/urlState.ts index 7311d3a..36b0e11 100644 --- a/frontend/src/lib/urlState.ts +++ b/frontend/src/lib/urlState.ts @@ -9,6 +9,7 @@ const KEYS = [ "show", "sort", "scope", + "source", "normal", "shorts", "live", @@ -28,6 +29,9 @@ export function filtersToParams(f: FeedFilters): URLSearchParams { if (f.show && f.show !== "unwatched") p.set("show", f.show); if (f.sort && f.sort !== "newest") p.set("sort", f.sort); if (f.scope === "all") p.set("scope", "all"); + // Library provenance filter (only meaningful in "all" scope); "organic" is the default. + if (f.scope === "all" && f.librarySource && f.librarySource !== "organic") + p.set("source", f.librarySource); if (!f.includeNormal) p.set("normal", "0"); if (f.includeShorts) p.set("shorts", "1"); if (f.includeLive) p.set("live", "1"); @@ -55,6 +59,10 @@ export function paramsToFilters(params: URLSearchParams, base: FeedFilters): Fee if (params.has("show")) f.show = params.get("show") || "unwatched"; if (params.has("sort")) f.sort = params.get("sort") || "newest"; if (params.has("scope")) f.scope = params.get("scope") === "all" ? "all" : "my"; + if (params.has("source")) { + const s = params.get("source"); + f.librarySource = s === "all" || s === "search" ? s : "organic"; + } if (params.has("normal")) f.includeNormal = params.get("normal") !== "0"; if (params.has("shorts")) f.includeShorts = params.get("shorts") === "1"; if (params.has("live")) f.includeLive = params.get("live") === "1";