fix(url): strip leftover query string once signed in

The pre-login ?access=requested (and ?verify/?reset) lingered in the address bar
after login. Strip the query string on auth (the logged-in app reads nothing from
the URL); Welcome still reads its params while logged out. stripUrlParams now
preserves history.state so it's safe to call after the in-app page stamp.
This commit is contained in:
npeter83 2026-06-26 01:13:26 +02:00
parent 04d3367c88
commit de58ded923
2 changed files with 13 additions and 5 deletions

View file

@ -115,10 +115,11 @@ export function shareUrl(f: FeedFilters, page: Page = "feed"): string {
return `${window.location.origin}${window.location.pathname}${qs ? `?${qs}` : ""}`;
}
/** Strip any filter/page query params from the address bar (after hydrating from a share
* link), leaving a clean URL without touching history. */
/** Strip the query string from the address bar (after hydrating from a share/auth link),
* leaving a clean URL. Preserves the current history.state (e.g. the in-app `sfPage` stamp)
* so it's safe to call at any time, not just before that stamp is written. */
export function stripUrlParams(): void {
if (window.location.search) {
window.history.replaceState(null, "", window.location.pathname);
window.history.replaceState(window.history.state, "", window.location.pathname);
}
}