mirror of
https://github.com/stashapp/stash.git
synced 2025-12-16 05:13:46 +01:00
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:
parent
1b864f28f6
commit
d831e4573c
1 changed files with 23 additions and 4 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue