fix: backdrop flashing
This commit is contained in:
5 files changed
+585
-1990
No files matched your search
+11
-12
@@ -260,6 +260,12 @@ function AppReady() {
|
||||
|
||||
useEffect(() => window.scrollTo(0, 0), [location.key]);
|
||||
|
||||
// Reset BakcdropImageLoading for every new image
|
||||
useEffect(() => {
|
||||
setBackdropLoading(true);
|
||||
console.debug("Image loading");
|
||||
}, [backdropId]);
|
||||
|
||||
useLayoutEffect(() => {
|
||||
async function checkForUpdates() {
|
||||
try {
|
||||
@@ -407,7 +413,7 @@ function AppReady() {
|
||||
<div className="app-backdrop-container">
|
||||
<AnimatePresence>
|
||||
<motion.img
|
||||
key={`${backdropId}${backdropLoading}`}
|
||||
key={backdropId}
|
||||
src={backdropUrl}
|
||||
alt=""
|
||||
className="app-backdrop"
|
||||
@@ -421,19 +427,12 @@ function AppReady() {
|
||||
opacity: 0,
|
||||
}}
|
||||
transition={{
|
||||
duration: 1.2,
|
||||
ease: "easeInOut",
|
||||
}}
|
||||
onLoadCapture={() => {
|
||||
setBackdropLoading(true);
|
||||
}}
|
||||
onLoad={() => {
|
||||
setBackdropLoading(false);
|
||||
opacity: {
|
||||
duration: 1.2,
|
||||
},
|
||||
}}
|
||||
onLoad={() => setBackdropLoading(false)}
|
||||
loading="lazy"
|
||||
style={{
|
||||
transition: "opacity 1.2s",
|
||||
}}
|
||||
/>
|
||||
</AnimatePresence>
|
||||
</div>
|
||||
|
||||
@@ -360,7 +360,7 @@ const LibraryView = () => {
|
||||
|
||||
const scrollTrigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
threshold: 0,
|
||||
});
|
||||
|
||||
const [backdropItems, setBackdropItems] = useState([]);
|
||||
@@ -372,7 +372,7 @@ const LibraryView = () => {
|
||||
);
|
||||
setBackdropItems(backdropItemsTemp);
|
||||
}
|
||||
}, [items.dataUpdatedAt]);
|
||||
}, [items.isSuccess]);
|
||||
|
||||
useEffect(() => {
|
||||
if (backdropItems.length > 0) {
|
||||
|
||||
@@ -46,6 +46,7 @@ body {
|
||||
}
|
||||
|
||||
.app-backdrop {
|
||||
transition: 1.2s;
|
||||
object-fit: cover;
|
||||
width: calc(100% + 160px);
|
||||
height: calc(100% + 160px);
|
||||
|
||||
Reference in new issue
Block a user