Skip to content

Content disappear after client-side navigation using NuxtLink and only reappear on refresh (F5) #1481

Description

@MarcusBeladona

Version

"@nuxt/content": "^3.13.0",
"@nuxtjs/sanity": "^2.3.0",
"@sanity/image-url": "^2.1.1",
"better-sqlite3": "^12.9.0",
"nuxt": "^4.4.4",
"vue": "^3.5.33",
"vue-router": "^5.0.6"

Nuxt configuration

export default defineNuxtConfig({
	compatibilityDate: '2025-07-15',
	devtools: { enabled: true },
	modules: ['@nuxtjs/sanity', "@nuxt/content"],
	sanity: {
		projectId: "13nqy3rm",
		dataset: "production",
		apiVersion: "2025-10-01",
		useCdn: false,
		perspective: "drafts",
		typegen: {
			enabled: true,
			queryPaths: ["./app/**/*.{ts,tsx,vue}"],
		}
	},
	runtimeConfig: {
		sanity: {
			token: process.env.NUXT_SANITY_TOKEN,
		}
	}
})

Reproduction

Link:
Github Repository
Video:
Image

What is expected?

When navigating through the site using NuxtLink, the content (list of posts on the homepage) should always remain visible and correctly rendered.

The posts should not disappear when navigating between routes, and the data should be properly preserved or refetched when returning to the homepage.


What is actually happening?

When running npm run dev, the homepage initially displays the list of posts correctly.

However, the following issues occur during navigation:

  • On initial load (localhost:3000), the posts are displayed as expected.
  • Clicking on a post navigates to the post detail page but does NOT show its content (null).
  • When navigating back to the homepage, the list of posts disappears and the page becomes blank OR partially empty.
  • In some cases, even the post content appears empty or inconsistently rendered.
  • The content only reappears after manually refreshing the page (F5).

This suggests that the data is not being properly refetched or preserved during client-side navigation.


Steps to reproduce

  1. Run the development server:
    npm run dev
    

End

Please help me find a solution, it happen in every project I've created so far during this week.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions