Skip to content

[gatsby-source-contentful] Gatsby unaware of change in Contentful unless delete cache folder #3495

Closed
@hrisng

Description

Hi, I'm facing a lot of issues that relate directly to the cache folder.

Description

  1. If I query a reverse item in one of my query, for example, content type Brand is linked to Category, and I have the following query:
contentfulCategory {
  id
  brand {
    id
  }
}

Gatsby would not aware if I publish a new Brand, and the Category page remain the same. If I query for brand directly instead in brand template, the brand page is generated successfully. When I delete the cache folder, and run again, all query and pages work as expected.

  1. If I add a new field to content type Category (that Brand link to) and is queried as above, then run gatsby develop, I would get the error unknown field brand in contentfulCategory. (query for brand from Category also won't work in Graphiql IDE). Again, manually delete the cache folder and run again solve the problem.

  2. When I delete a field successfully in Contentful, that field will still be queryable in Gatsby. Delete cache folder also solve this.

Step to reproduce

  1. Create content type Category and Brand (or any A and B)
  2. In Brand, add a reference to Category
  3. Run gatsby develop, it compiles successfully
  4. Try each case in the description
  5. Run gastby develop, and see the result
  6. Delete the cache folder and run again, it work correctly.

Environment

Gatsby version: 1.9.145
Node.js version: 6.9.1
Operating System: Windows 6.1.7601

More Info

I'm using gatsby-plugin-react-next.
Before I found out deleting the cache folder help with the issues. Running gatsby develop multiple times would occasionally solve the problem.
Edit: It worked because I had some change in gatsby-node.js, which triggers the deletion of cache folder.

Request

Also, it would be great if there's a way to tell Gatsby to completely delete the cache folder on new build in the meantime. I didn't find anything in the documentation. Appreciate if you can show me the direction.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions