Next.js Discord

Discord Forum

Issue with ISR using App Router

Answered
Southern African anchovy posted this in #help-forum
Open in Discord
Avatar
Southern African anchovyOP
Hi all, i'm having a play with the new app router atm. I've used NextJS on a previous project using the page router. I'm having some issues with ISR on the new app router. Building the app locally for production and running I can see the time here never updates. I'm probably misunderstanding something, how do we invalidate a server component here?

import Link from 'next/link'

interface User {
  id: number
  name: string
}

export const revalidate = 10

export default async function UsersPage() {
  const response = await fetch('https://jsonplaceholder.typicode.com/users', {
    //cache: 'no-store',
    next: {
      revalidate: 10,
    },
  })
  const users: User[] = await response.json()

  return (
    <main>
      <h1 className={'text-xl'}>Users</h1>
      <p>{new Date().toLocaleTimeString()}</p>
      <ul>
        {users.map((user) => (
          <li key={user.id}>{user.name}</li>
        ))}
      </ul>
      <br />
      <Link className={'text-xl'} href={'/'}>
        Home
      </Link>
    </main>
  )
}
Answered by joulev
Weird… can you try a lower version?
View full answer

22 Replies

Answer
Avatar
Like 13.4.19
Then 13.4.18 and so on
A few hours ago a user also asked me this exact same issue
Avatar
Southern African anchovyOP
it's "next": "13.5.2",
Avatar
@Alfonsus Ardani have you tried refreshing twice after the 10th second
Avatar
Southern African anchovyOP
yes
Are you on windows
Avatar
Southern African anchovyOP
yeah windows 11
Avatar
Ok this smells like a windows-specific bug here cc @Florian
Try deploying on vercel (linux), does this bug occur?
Avatar
This wont help but It should work on 13.4.19 as ive been playing with revalidate a lot in windows
Avatar
Southern African anchovyOP
thought i'd try wsl quickly, same issue. let me grab my macbook ...
Avatar
Southern African anchovyOP
same issue on the mac
@joulev works on "next": "13.4.19", I can see it updating now every 10 seconds. Thanks @Alfonsus Ardani
Avatar
@joulev You should open a bug report
Avatar
Southern African anchovyOP
Thanks, yeah I was just looking on there to see if it's already been raised
Avatar
That's weird
If you are on Chrome, can you try it on Firefox with the latest next version? that worked for me 😆
Avatar
bonkers haha