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.
This commit is contained in:
smith113-p
2025-11-06 00:20:17 -05:00
committed by GitHub
parent 1b864f28f6
commit d831e4573c

View File

@@ -174,14 +174,33 @@ export const TaggerContext: React.FC = ({ children }) => {
}, [Scrapers.data, stashConfig]); }, [Scrapers.data, stashConfig]);
useEffect(() => { useEffect(() => {
if (sources.length && !currentSource) { if (!sources.length || currentSource) {
setCurrentSource(sources[0]); 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(() => { useEffect(() => {
setSearchResults({}); setSearchResults({});
}, [currentSource]); const selectedEndpoint = currentSource?.sourceInput.stash_box_endpoint;
if (selectedEndpoint && selectedEndpoint !== config.selectedEndpoint) {
setConfig({
...config,
selectedEndpoint,
});
}
}, [currentSource, config, setConfig]);
function getPendingFingerprints() { function getPendingFingerprints() {
const endpoint = currentSource?.sourceInput.stash_box_endpoint; const endpoint = currentSource?.sourceInput.stash_box_endpoint;