Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

[bug] Node crashing when using onCreatePage #220

Open
mrseanbaines opened this issue Jun 2, 2020 · 1 comment
Open

[bug] Node crashing when using onCreatePage #220

mrseanbaines opened this issue Jun 2, 2020 · 1 comment

Comments

@mrseanbaines
Copy link

Description

When implementing Gatsby's onCreatePage function to dynamically generate localized versions of pages, with gatsby-source-prismic-graphql Gatsby appears to get into an infinite loop on the createPagesStatefully step, thus preventing page generation and startup.

I realise this plugin has options to dynamically create pages without the need for utilizing Gatsby's onCreatePage, however, I would like more granular control over this (e.g. using country codes instead of language codes), also I am migrating from Contentful and still have pages that require this existing system for creating localized pages.

const countries = ["gb", "de", "es"]

exports.onCreatePage = async ({ page, actions }) => {
  actions.deletePage(page)

  countries.forEach(country => {
    actions.createPage({
      ...page,
      path: `/${country}${page.path}`,
    })
  })
}

Minimal reproduction: https://github.com/mrseanbaines/gatsby-prismic-blog

Related issues

#164

@cbasJS
Copy link

cbasJS commented Jun 12, 2020

Same issue here. Someone else?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants