Overhaul graphql client cache invalidation #3912
Merged
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.
This is a complete rework of the client-side cache invalidation done after mutations are run. I've tried my best to have it refetch as little as possible while avoiding displaying stale data, but it's possible I could have missed some edge cases.
The main issue this should solve is the first part of #3891, where previously creating a new performer/studio/tag would cause massive slowdowns and excessive database queries. What was happening is that the Create mutations were invalidating the
All(Performers/Studios/Tags)ForFilter
queries, which are slow and expensive queries, especially with very large databases. Invalidating those queries is not necessary, we can make the change client-side by just appending the new object to the end of the list.There should also be fewer unnecessary queries after mutations, and less stale data in the UI:
And then I've also added the
graphql
directory to theprettier
command to format the schema files, since prettier supports graphql and some of those files are quite badly formatted right now.Fixes #3815 (I believe)