mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 12:54:38 +03: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:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user