From d831e4573ca35955e40e3494c2cd3bbe181de2c3 Mon Sep 17 00:00:00 2001 From: smith113-p <205463041+smith113-p@users.noreply.github.com> Date: Thu, 6 Nov 2025 00:20:17 -0500 Subject: [PATCH] Remember the selected stash box in scene tagger (#6192) * Remember the selected stash box in scene tagger This stores the selected stash box in the config, the same way that studio and performer tagger do (it uses the same setting). If a non-stashbox source (scraper) is selected, this is not remembered. --- ui/v2.5/src/components/Tagger/context.tsx | 27 +++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/ui/v2.5/src/components/Tagger/context.tsx b/ui/v2.5/src/components/Tagger/context.tsx index 434a47cce..7db84a11a 100644 --- a/ui/v2.5/src/components/Tagger/context.tsx +++ b/ui/v2.5/src/components/Tagger/context.tsx @@ -174,14 +174,33 @@ export const TaggerContext: React.FC = ({ children }) => { }, [Scrapers.data, stashConfig]); useEffect(() => { - if (sources.length && !currentSource) { - setCurrentSource(sources[0]); + if (!sources.length || currentSource) { + return; } - }, [sources, currentSource]); + // First, see if we have a saved endpoint. + if (config.selectedEndpoint) { + let source = sources.find( + (s) => s.sourceInput.stash_box_endpoint == config.selectedEndpoint + ); + if (source) { + setCurrentSource(source); + return; + } + } + // Otherwise, just use the first source. + setCurrentSource(sources[0]); + }, [sources, currentSource, config]); useEffect(() => { setSearchResults({}); - }, [currentSource]); + const selectedEndpoint = currentSource?.sourceInput.stash_box_endpoint; + if (selectedEndpoint && selectedEndpoint !== config.selectedEndpoint) { + setConfig({ + ...config, + selectedEndpoint, + }); + } + }, [currentSource, config, setConfig]); function getPendingFingerprints() { const endpoint = currentSource?.sourceInput.stash_box_endpoint;