perf(startup): instant splash, cached home and non-blocking auth
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped

Renders a static branded splash immediately, restores the last user/API session from disk, hydrates home/library queries from localStorage, shows a home skeleton while the first request runs, drops blocking auth network checks, and redirects a streamless /player to home.
This commit is contained in:
1xDed committed 2026-11-28 17:08:08 +03:00
1 parent b1d9b40def
commit 205b655d00
12 files changed
+424 -158

No files matched your search

+13 -1
View File
@@ -10,7 +10,7 @@ import "./videoPlayer.scss";
import { RepeatMode } from "@jellyfin/sdk/lib/generated-client";
import { useMutation } from "@tanstack/react-query";
import { createFileRoute, useRouter } from "@tanstack/react-router";
import { createFileRoute, useNavigate, useRouter } from "@tanstack/react-router";
import JASSUB from "jassub";
import wasmUrl from "jassub/dist/wasm/jassub-worker.wasm?url"; // non-SIMD fallback
import modernWasmUrl from "jassub/dist/wasm/jassub-worker-modern.wasm?url"; // SIMD
@@ -82,6 +82,7 @@ function addSubtitleTrackToReactPlayer(
export function VideoPlayer() {
const api = useApiInContext((s) => s.api);
const navigate = useNavigate();
const { history } = useRouter();
const player = useRef<HTMLVideoElement | null>(null);
/** Re-apply the transfer/resume position until the HLS player stabilises. */
@@ -599,6 +600,17 @@ export function VideoPlayer() {
setError(e);
}, []);
// A direct/reloaded /player route with no active stream must not trap the
// user on an endless spinner.
useEffect(() => {
if (playbackStream) return;
const timer = window.setTimeout(
() => navigate({ to: "/home", replace: true }),
250,
);
return () => window.clearTimeout(timer);
}, [playbackStream, navigate]);
if (!playbackStream) {
return (
<div className="video-player">