fix: stop artwork/background flashing when pages open
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
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
- disable router view transitions (they cross-faded through a black frame) - keep the last app backdrop instead of clearing it to nothing on navigation - drop opacity fade-in on cards, hero and detail artwork: cached images must be visible on the first paint, not fade from empty - keep the hero slide mounted so the old image remains until the new one loads - ambient backdrop falls back to the poster BlurHash for poster-only items - show the router loader only after 250ms so fast navigations don't blink
This commit is contained in:
1 parent
4c9dd86962
commit
b00f93d262
10 files changed
+51
-46
No files matched your search
@@ -5,15 +5,20 @@ import { useBackdropStore } from "@/utils/store/backdrop";
|
||||
import BlurhashCanvas from "../blurhash-canvas";
|
||||
|
||||
export default function Backdrop() {
|
||||
// const [backdropLoading, setBackdropLoading] = useState(true);
|
||||
|
||||
const { backdropHash } = useBackdropStore(
|
||||
useShallow((state) => ({
|
||||
backdropHash: state.backdropHash,
|
||||
})),
|
||||
);
|
||||
|
||||
if (!backdropHash) {
|
||||
// Routes clear the backdrop when they mount ("") and some set it later.
|
||||
// Keep the last non-empty hash so the app background never blanks out
|
||||
// (which looked like a flash on every page open).
|
||||
const lastHash = React.useRef<string | undefined>(undefined);
|
||||
if (backdropHash) lastHash.current = backdropHash;
|
||||
const hash = backdropHash || lastHash.current;
|
||||
|
||||
if (!hash) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -22,16 +27,16 @@ export default function Backdrop() {
|
||||
<motion.div
|
||||
initial={{ opacity: 0 }}
|
||||
animate={{ opacity: 1 }}
|
||||
key={backdropHash}
|
||||
key={hash}
|
||||
exit={{ opacity: 0 }}
|
||||
transition={{
|
||||
duration: 2,
|
||||
duration: 0.45,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
className="app-backdrop-container"
|
||||
>
|
||||
<BlurhashCanvas
|
||||
blurhashString={backdropHash}
|
||||
blurhashString={hash}
|
||||
width={300}
|
||||
height={150}
|
||||
canvasProps={{
|
||||
@@ -47,4 +52,4 @@ export default function Backdrop() {
|
||||
</motion.div>
|
||||
</AnimatePresence>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user