Next.js 14: Data Not Updating Despite Changes, Tried Revalidation and 'no-store' Caching
Muhammad-Hashim opened this issue · comments
Hello, I'm using the latest version of Next.js (version 14), and I'm facing an issue where the data doesn't refresh when I make changes on the live website. Strangely, when I modify the data locally, the changes are reflected. I've attempted to address this by setting revalidation: 1, but unfortunately, it hasn't had any effect. Additionally, I've set caching to 'no-store'. Am I overlooking something? Please provide guidance on resolving this issue.
Could you share your createClient
configuration, as well as what version of Sanity packages you're on?
The fix is to pass in the cache
as the third argument to client.fetch
, instead of the second argument:
-const posts = await client.fetch<Post[]>(`*[_type == "post"]`, {cache: 'no-store'})
+const posts = await client.fetch<Post[]>(`*[_type == "post"]`, {}, {cache: 'no-store'})