From 3ac316edf729efa0c205da222493ac174c465e8b Mon Sep 17 00:00:00 2001 From: dannybunschoten Date: Wed, 28 Aug 2024 09:18:27 +0200 Subject: [PATCH] see if this works --- app/page.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app/page.tsx b/app/page.tsx index 3b7e93e..77aa3e1 100644 --- a/app/page.tsx +++ b/app/page.tsx @@ -136,6 +136,16 @@ export default function Home() { rollWheelItems: newRollWheelItems, rollWheelOffsets: initializeRollWheelOffsets(), }); + + const preloadImages = async () => { + const imagePaths = ITEMS.map((item) => `/${item}.png`); + for (const path of imagePaths) { + const img = new Image(); + img.src = path; + await img.decode(); // Ensures the image is fully loaded + } + }; + preloadImages(); }, []); const handleClick = () => {