Adjust default view selection for auth state

This commit is contained in:
thePR0M3TH3AN committed 2026-01-18 20:25:30 -05:00
1 parent 26fd31e212
commit f70217003d
2 files changed
+9 -4

No files matched your search

+4 -1
View File
@@ -775,9 +775,12 @@ class Application {
devLogger.log(
"[app.init()] No #view= in the URL, loading default home view"
);
const defaultView = this.isUserLoggedIn()
? "views/for-you.html"
: "views/most-recent-videos.html";
if (typeof this.loadView === "function") {
await Promise.all([
this.loadView("views/most-recent-videos.html"),
this.loadView(defaultView),
watchHistoryInitPromise,
]);
} else {
+5 -3
View File
@@ -1392,9 +1392,11 @@ async function handleHashChange() {
try {
if (!match || !match[1]) {
// No valid "#view=..." => default to "most-recent-videos"
await loadView("views/most-recent-videos.html");
const initFn = viewInitRegistry["most-recent-videos"];
// No valid "#view=..." => default to "for-you" when logged in
const isLoggedIn = getApplication()?.isUserLoggedIn();
const defaultViewName = isLoggedIn ? "for-you" : "most-recent-videos";
await loadView(`views/${defaultViewName}.html`);
const initFn = viewInitRegistry[defaultViewName];
if (typeof initFn === "function") {
await initFn();
}