[1.0] During bootstrap, detect if plugins have changed and delete the cache #927
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We want the cache to be 100% reliable so people will rely on it (and it won't be the source of annoying bugs). This PR addresses one of the last source of cache problems where a user updates a plugin which changes some sort of data transformation algorithm so invalidates the data in the cache.
This PR is perhaps overly cautious but it's the easiest way I could think of to implement this idea and we can get more precise in the future.
Basically it looks at the version number of every installed plugin as well as computes a hash of the site's
package.json
,gatsby-config.js
, andgatsby-node.js
. If any of those have changed since the last bootstrap, then the cache is deleted.