import { AnimatePresence, motion } from "motion/react"; import React from "react"; import { useShallow } from "zustand/shallow"; import { useBackdropStore } from "@/utils/store/backdrop"; import BlurhashCanvas from "../blurhash-canvas"; export default function Backdrop() { const { backdropHash } = useBackdropStore( useShallow((state) => ({ backdropHash: state.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(undefined); if (backdropHash) lastHash.current = backdropHash; const hash = backdropHash || lastHash.current; if (!hash) { return null; } return ( ); }