Docz: "Page not found" for new pages without the restart of dev-build

Created on 29 Dec 2019  路  9Comments  路  Source: doczjs/docz

Bug Report

Describe the bug

There is a gatsby 404 error for new pages without restart of dev-build.

The page after creation is visible in the sidebar:

image

But it's not accessible by the link and the route:

image

It's required to restart the build to make the new page work.

To Reproduce

  1. yarn create docz-app docz-app-basic --example basic
  2. yarn dev
  3. open the site
  4. create src/hello.mdx
  5. try to visit the new page, see 404 gatsby error

Expected behavior

It's expected that the new page will be available on fly.

Environment

  • docz version: [latest, 2.2.0]
  • OS: [OSX 10.14.6]
  • Node/yarn version: [node 10.16.3/yarn 1.19.1]
gatsby-theme-docz stale

Most helpful comment

Facing the same issue锛宒o you find any workaround?

All 9 comments

Facing the same issue锛宒o you find any workaround?

Facing same problem, the only way I figured out is terminating npm and building it again.

Same thing here, pages are not created on the .docz folder when the new build is generated.

it seems that an issue was caused by this fix: https://github.com/doczjs/docz/commit/dad228fff5cbe4c9f989d96a16f8f3c598b98bea#diff-10b0f76ede3ea173b8dda2af33c892a9

that fix stops completely re-creating all pages on every file change, but it also looks like that it stops creating new pages too

in example, exports.createPages = require('./lib/createPagesStatefully') works fine

so, in general, we should make efficient incremented updates for already created pages, but also still create new pages too

as I understood gatsby docs well (https://www.gatsbyjs.org/docs/node-apis/#createPagesStatefully), with createPagesStatefully it's required to watch pages independently, like this plugin: https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-page-creator/src/gatsby-node.js#L60

but maybe we can just call createPage only for new pages on a simple createPages event?

Hey @lttb,

I think you accurately described the problem and the solution.
We need to replace createPagesStatefully back with createPagr

Hey @lttb,

I think you accurately described the problem and the solution.
We need to replace createPagesStatefully back with createPages and only create if we receive a new file event or add a file-added listener in createPagesStatefully.

Anyone up for submitting a PR? Happy to help with it!

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Any precision of the solution?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

regrettably picture regrettably  路  3Comments

kachkaev picture kachkaev  路  3Comments

ilyanoskov picture ilyanoskov  路  3Comments

mariusespejo picture mariusespejo  路  3Comments

danburzo picture danburzo  路  3Comments