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>
+2 -2
View File
@@ -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) {
+1
View File
@@ -46,6 +46,7 @@ body {
}
.app-backdrop {
transition: 1.2s;
object-fit: cover;
width: calc(100% + 160px);
height: calc(100% + 160px);