soulseek: let a filtered row open into its real contents
the tree search asked for no limit and clampInt read a missing param as 0 (Number(null) is 0, and 0 is finite), so it clamped to the minimum and ran with LIMIT 1: one match came back, its siblings looked like non-matches, and a folder with 25 matching albums showed none of them. on top of that, a filtered row was a dead end — it only ever showed the matches, with a note counting what it was hiding. now the note is the same "show all N folders" button browse mode already had: clicking it drops that row out of the filtered set, so from there down it is ordinary lazy browsing, which is usually why you searched for the folder in the first place. dropped the "don't match the filter" wording with it, since a truncated result makes that sentence false. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -58,6 +58,10 @@ const DIR_PAGE_DEFAULT = 200;
|
||||
const SEARCH_MATCH_MAX = 1000;
|
||||
const SEARCH_MATCH_DEFAULT = 300;
|
||||
const clampInt = (raw: string | null, fallback: number, min: number, max: number): number => {
|
||||
// An absent param has to be caught before Number(): `Number(null)` is 0, not NaN, so it passed the
|
||||
// finite check and clamped to `min` — which ran the tree search with LIMIT 1 and returned a single
|
||||
// match, making its siblings look like non-matches in the UI.
|
||||
if (raw === null || raw.trim() === '') return fallback;
|
||||
const n = Number(raw);
|
||||
if (!Number.isFinite(n)) return fallback;
|
||||
return Math.min(max, Math.max(min, Math.trunc(n)));
|
||||
|
||||
Reference in New Issue
Block a user