mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03:00
Cache fixes (#1048)
* Bust cache for studio/tag image updates * Reset cache when a scan/clean has been run
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
* Allow configuration of visible navbar items.
|
||||
|
||||
### 🎨 Improvements
|
||||
* Reset cache after scan/clean to ensure scenes are updated.
|
||||
* Add more video/image resolution tags.
|
||||
* Add option to strip file extension from scene title when populating from scanning task.
|
||||
* Pagination support and general improvements for image lightbox.
|
||||
@@ -20,6 +21,7 @@
|
||||
* Support configurable number of threads for scanning and generation.
|
||||
|
||||
### 🐛 Bug fixes
|
||||
* Fix tag/studio images not being changed after update.
|
||||
* Fixed resolution tags and querying for portrait videos and images.
|
||||
* Corrected file sizes on 32bit platforms
|
||||
* Fixed login redirect to remember the current page.
|
||||
|
||||
@@ -134,6 +134,10 @@ export const Studio: React.FC = () => {
|
||||
input: getStudioInput() as GQL.StudioUpdateInput,
|
||||
},
|
||||
});
|
||||
if (result.data?.studioUpdate?.image_path)
|
||||
await fetch(result.data?.studioUpdate?.image_path, {
|
||||
cache: "reload",
|
||||
});
|
||||
if (result.data?.studioUpdate) {
|
||||
updateStudioData(result.data.studioUpdate);
|
||||
setIsEditing(false);
|
||||
|
||||
@@ -133,6 +133,8 @@ export const Tag: React.FC = () => {
|
||||
},
|
||||
});
|
||||
if (result.data?.tagUpdate) {
|
||||
if (result.data.tagUpdate.image_path)
|
||||
await fetch(result.data.tagUpdate.image_path, { cache: "reload" });
|
||||
updateTagData(result.data.tagUpdate);
|
||||
setIsEditing(false);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import { WebSocketLink } from "@apollo/client/link/ws";
|
||||
import { onError } from "@apollo/client/link/error";
|
||||
import { getMainDefinition } from "@apollo/client/utilities";
|
||||
import { createUploadLink } from "apollo-upload-client";
|
||||
import * as GQL from "src/core/generated-graphql";
|
||||
|
||||
// Policies that tell apollo what the type of the returned object will be.
|
||||
// In many cases this allows it to return from cache immediately rather than fetching.
|
||||
@@ -140,6 +141,27 @@ export const createClient = () => {
|
||||
cache,
|
||||
});
|
||||
|
||||
// Watch for scan/clean tasks and reset cache when they complete
|
||||
let prevStatus = "Idle";
|
||||
client
|
||||
.subscribe<GQL.MetadataUpdateSubscription>({
|
||||
query: GQL.MetadataUpdateDocument,
|
||||
})
|
||||
.subscribe({
|
||||
next: (res) => {
|
||||
const currentStatus = res.data?.metadataUpdate.status;
|
||||
if (currentStatus) {
|
||||
if (
|
||||
currentStatus === "Idle" &&
|
||||
(prevStatus === "Scan" || prevStatus === "Clean")
|
||||
) {
|
||||
client.resetStore();
|
||||
}
|
||||
prevStatus = currentStatus;
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
return {
|
||||
cache,
|
||||
client,
|
||||
|
||||
Reference in New Issue
Block a user