Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 66x 66x 66x | import { useSearchParams } from "react-router-dom";
/**
* `?version=` as a positive integer, or null — the revision a resource page
* opens its edit history on. Parsed rather than trusted: a hand-edited URL
* must land on the newest version, not on NaN.
*
* Links into it come from records of something that ran under a revision:
* an agent turn on the Activity page, a skill run.
*/
export function useVersionParam(): number | null {
const [searchParams] = useSearchParams();
const raw = Number(searchParams.get("version"));
return Number.isInteger(raw) && raw > 0 ? raw : null;
}
|