function useCanonicalPath
useCanonicalPath(canonical: string | null | undefined): void

Replaces the current path with canonical when they differ, keeping the query string, the hash and the history entry's state. It replaces the entry, so going back skips the old path. Nothing happens while canonical is null, as while the page loads. The profile, dump, dump editor and playlist pages call it.

Parameters

canonical: string | null | undefined

Return Type

void

Usage

import { useCanonicalPath } from "src/hooks/shared/useCanonicalPath.ts";