Merge pull request #1549 from PR0M3TH3AN/fix-video-link-params-14223048263665822746

Fix video link redirect clearing URL params
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-22 23:20:44 -05:00
commit 20a4ed0386
2 files changed
+8 -3

No files matched your search

+4 -1
View File
@@ -4355,8 +4355,11 @@ class Application {
const currentView = getHashViewName();
const normalizedView =
typeof currentView === "string" ? currentView.toLowerCase() : "";
const urlParams = new URLSearchParams(window.location.search);
const hasVideoParam = urlParams.has("v");
if (!normalizedView || normalizedView === "most-recent-videos") {
setHashView("for-you");
setHashView("for-you", { preserveVideoParam: hasVideoParam });
}
const rawProviderId =
+4 -2
View File
@@ -14,14 +14,16 @@ export function getHashViewName() {
return viewName.trim();
}
export function setHashView(viewName) {
export function setHashView(viewName, options = {}) {
if (typeof window === "undefined") {
return;
}
const url = new URL(window.location.href);
url.searchParams.delete("modal");
url.searchParams.delete("v");
if (!options?.preserveVideoParam) {
url.searchParams.delete("v");
}
const newUrl = url.pathname + url.search + `#view=${viewName}`;
window.history.replaceState({}, "", newUrl);