postalservice14 postalservice14 - 26 days ago 22
Node.js Question

Relay/GraphQL Schema cache not updating when I update schema on server side

I have a React app using Relay and a remote GraphQL server. When I start the webpack server, I have it fetch the latest schema and feed it into the babel-relay-plugin.

It works great....except when I make a schema change. It appears React or Relay or webpack or something is caching the schema, because I'll get a Schema validation error in the browser console when I run the app. However, when I run the query manually against the GraphQL server using GraphIQL, the query is successful. So it would have to be some sort of cache on the react, relay, webpack side I'm thinking?

Things I've tried:


  1. List item

  2. Restarting webpack server

  3. Removing
    node_modules
    and
    npm install

  4. I've even tried restarting my computer (that actually seemed to work, but may be coincidence)



Thanks in advance for your help.

Answer

Turns out, of course, it was human error. I had cacheDirectory as true in my babel-loader query. You can read about it on the babel-loader readme (just do a find on page for 'cacheDirectory') https://github.com/babel/babel-loader

Once I changed that to false, which is the default. The problem went away. Hope that helps others.

Comments