Skip to content

Commit

Permalink
try better cache busting
Browse files Browse the repository at this point in the history
  • Loading branch information
Highfire1 committed Dec 4, 2024
1 parent 0ef7a16 commit 3ea8abe
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions frontend/src/app/Hero.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// "use client";

import Image from 'next/image';
import { cookies } from 'next/headers'

import hero1 from '../../public/hero_images/langara1.png'
import hero2 from '../../public/hero_images/langara2.png'
Expand All @@ -9,18 +10,16 @@ import hero4 from '../../public/hero_images/langara4.png'
import hero5 from '../../public/hero_images/langara5.png'


async function WAKEUP() {
await fetch(`https://example.com`);
return;
}

// otherwise next.js will cache the total route result and it will not be random
export const dynamic = 'force-dynamic';

let imageCounter = 0;

export default function Hero() {
WAKEUP()
export default async function Hero() {
const cookieStore = await cookies()
const theme = cookieStore.get('theme')

const images = [hero1, hero2, hero3, hero4, hero5]

const selectedImage = images[imageCounter % images.length];
Expand Down

0 comments on commit 3ea8abe

Please sign in to comment.