nuxt / content

The file-based CMS for your Nuxt application, powered by Markdown and Vue components.
https://content.nuxt.com
MIT License
3.15k stars 630 forks source link

Document not found when disabling ssr in document driven mode #2215

Open Ewocker opened 1 year ago

Ewocker commented 1 year ago

Environment

I tried from @nuxt/content@2.5.x to latest.

Reproduction

To reproduce, it is as simple as using the document-driven folder from example/essentials of nuxt-content repo. Just add ssr: false in nuxt.config.ts

Reproduction Repo: https://github.com/Ewocker/nuxt-content-document-driven-bug This reproduction repo is based on official example from nuxt-content repo here: https://github.com/nuxt/content/tree/main/examples/essentials/document-driven

Steps:

  1. yarn install && yarn dev
  2. see page is showing as document not found
  3. go to content/1.index.md and press cmd + s to save the content and trigger an update from hot-reload
  4. page becomes content from 1.index.md

This happens again after reloading the page, and not found will be shown by default for production build. Ex. yarn build than yarn start.

Describe the bug

Page is always "document not found" in development mode until first hot reload is triggered. when disabling ssr in document driven mode.

Additional context

No response

Logs

No response

Ewocker commented 1 year ago

@Atinux sorry for tagging, just want to see if anyone active is aware of the issue.

atinux commented 1 year ago

Do you have a small reproduction on GitHub or Stackblitz @Ewocker ?

Ewocker commented 1 year ago

Thanks for responding to the issue @Atinux

Do you have a small reproduction on GitHub or Stackblitz @Ewocker ?

Just added to the issue description. Here are the repo and steps:


To reproduce, it is as simple as using the document-driven folder from example/essentials of nuxt-content repo. Just add ssr: false in nuxt.config.ts

Reproduction Repo: https://github.com/Ewocker/nuxt-content-document-driven-bug This reproduction repo is based on official example from nuxt-content repo here: https://github.com/nuxt/content/tree/main/examples/essentials/document-driven

Steps:

  1. yarn install && yarn dev
  2. see page is showing as document not found
  3. go to content/1.index.md and press cmd + s to save the content and trigger an update from hot-reload
  4. page becomes content from 1.index.md

This happens again after reloading the page, and not found will be shown by default for production build. Ex. yarn build than yarn start.

Ewocker commented 1 year ago

@Atinux can you please take a look at this when you get a chance?

farnabaz commented 1 year ago

Hey @Ewocker, Try enabling clientDB in nuxt.config.ts

export default defineNuxtConfig({
  ssr: false,
  modules: ['@nuxt/content'],
  content: {
    documentDriven: true,
    experimental: {
      clientDB: true,
    },
  },
});

Note that client side database/query is still experimental and could only be used with clientDB flag. With the release of v3 it will be an official feature of the module.