diff --git a/ui/v2.5/src/components/Changelog/versions/v050.md b/ui/v2.5/src/components/Changelog/versions/v050.md index 1b9f2410a..2d625495d 100644 --- a/ui/v2.5/src/components/Changelog/versions/v050.md +++ b/ui/v2.5/src/components/Changelog/versions/v050.md @@ -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. diff --git a/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx b/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx index a3754f94b..79571f839 100644 --- a/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx +++ b/ui/v2.5/src/components/Studios/StudioDetails/Studio.tsx @@ -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); diff --git a/ui/v2.5/src/components/Tags/TagDetails/Tag.tsx b/ui/v2.5/src/components/Tags/TagDetails/Tag.tsx index 53a975be5..0583ac60b 100644 --- a/ui/v2.5/src/components/Tags/TagDetails/Tag.tsx +++ b/ui/v2.5/src/components/Tags/TagDetails/Tag.tsx @@ -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); } diff --git a/ui/v2.5/src/core/createClient.ts b/ui/v2.5/src/core/createClient.ts index 0d40fbe15..913222e5a 100644 --- a/ui/v2.5/src/core/createClient.ts +++ b/ui/v2.5/src/core/createClient.ts @@ -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({ + 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,