fix: backdrop flashing

This commit is contained in:
Prayag Prajapati committed 2024-04-27 10:25:38 +05:30
1 parent 38946a126b
commit e7af13970c
5 files changed
+585 -1990

No files matched your search

+11 -12
View File
@@ -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>