Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Overhaul graphql client cache invalidation #3912

Merged
merged 8 commits into from Jul 28, 2023

Conversation

DingDongSoLong4
Copy link
Collaborator

@DingDongSoLong4 DingDongSoLong4 commented Jul 15, 2023

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:

  • no "FindStudio" for the new studio after a "StudioCreate", for example
  • no "FindStudio" for studio id 10 after a "StudioDestroy" for studio id 10
  • The stats page is automatically updated client-side for things like creating/destroying studios, tags, etc, so no refetch is required
  • A scene's play count, play duration, etc are now updated client-side after running the activity tracking mutations, meaning the activity data in the "File Info" tab now gets updated live as the scene is watched.

And then I've also added the graphql directory to the prettier 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)

@WithoutPants WithoutPants added this to the Version 0.22.0 milestone Jul 25, 2023
@WithoutPants WithoutPants added bug Something isn't working bounty This issue has a bounty on it in the OpenCollective labels Jul 26, 2023
@WithoutPants WithoutPants merged commit 7b77b89 into stashapp:develop Jul 28, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bounty This issue has a bounty on it in the OpenCollective bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug Report] Performance Issue when Adding Performer in Scene Tagger
2 participants