List the last visited workspace first in the rail

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-10-28 19:48:38 +01:00
co-authored by Claude Opus 5.5
parent c1c866876e
commit d352ac924a
17 changed files with 190 additions and 20 deletions
+20
View File
@@ -0,0 +1,20 @@
type Params = {
value?: string | number | null;
};
/**
* A positive whole number from a cookie or query value, or null when it
* isn't one, so a hand-edited value never reaches a query. Surrounding
* whitespace is trimmed.
*/
export default function parsePositiveId({ value }: Params): number | null {
if (value === undefined || value === null) return null;
const raw = String(value).trim();
if (!/^\d+$/.test(raw)) return null;
const id = Number(raw);
return Number.isSafeInteger(id) && id > 0 ? id : null;
}