This commit is contained in:
Manav Rathi 2024-04-16 19:54:00 +05:30
parent f78e4d3914
commit 2bb3e152f8
No known key found for this signature in database

View file

@ -162,12 +162,34 @@ export default function Slideshow() {
}
};
useEffect(() => {
if (currentFile) {
getRenderableFileURL();
const precacheNextRenderableFileURL = async () => {
if (!nextFile) return;
const cacheValue = renderableFileURLCache.get(nextFile.id);
if (cacheValue) return;
try {
const blob = await getPreviewableImage(
nextFile as EnteFile,
castToken,
);
const url = URL.createObjectURL(blob);
renderableFileURLCache.set(nextFile?.id, url);
} catch (e) {
return;
}
};
useEffect(() => {
getRenderableFileURL();
}, [currentFile]);
useEffect(() => {
precacheNextRenderableFileURL();
}, [nextFile]);
return (
<>
<SlideshowContext.Provider value={{ showNextSlide }}>