From 1f4213ae0bc7279b6ba3cf441611b3fb3f3d9ad6 Mon Sep 17 00:00:00 2001 From: "plebeius.eth" Date: Mon, 6 May 2024 22:08:49 +0200 Subject: [PATCH] perf: apply cachebuster to not found img and board banners --- src/components/board-banner/board-banner.tsx | 3 ++- src/views/not-found/not-found.tsx | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/board-banner/board-banner.tsx b/src/components/board-banner/board-banner.tsx index 8b522ac3..b6c90cdb 100644 --- a/src/components/board-banner/board-banner.tsx +++ b/src/components/board-banner/board-banner.tsx @@ -8,7 +8,8 @@ const totalBanners = 57; const ImageBanner = () => { const [imagePath] = useState(() => { const randomBannerIndex = Math.floor(Math.random() * totalBanners) + 1; - return `assets/banners/banner-${randomBannerIndex}.jpg`; + const cacheBuster = new Date().getTime(); + return `assets/banners/banner-${randomBannerIndex}.jpg?cacheBuster=${cacheBuster}`; }); return ; diff --git a/src/views/not-found/not-found.tsx b/src/views/not-found/not-found.tsx index 803a154d..0e2be030 100644 --- a/src/views/not-found/not-found.tsx +++ b/src/views/not-found/not-found.tsx @@ -9,7 +9,8 @@ const totalNotFoundImages = 2; const NotFoundImage = () => { const [imagePath] = useState(() => { const randomBannerIndex = Math.floor(Math.random() * totalNotFoundImages) + 1; - return `assets/not-found/not-found-${randomBannerIndex}.jpg`; + const cacheBuster = new Date().getTime(); + return `assets/not-found/not-found-${randomBannerIndex}.jpg?cacheBuster=${cacheBuster}`; }); return ;