mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 08:26:00 +01:00
Separate search clear effect from config saving (#6247)
Fixes Scrape results cache eviction in tagger view
This commit is contained in:
parent
96a7e087f2
commit
d52b6afd4a
1 changed files with 6 additions and 0 deletions
|
|
@ -173,6 +173,7 @@ export const TaggerContext: React.FC = ({ children }) => {
|
||||||
setSources(stashboxSources.concat(scraperSources));
|
setSources(stashboxSources.concat(scraperSources));
|
||||||
}, [Scrapers.data, stashConfig]);
|
}, [Scrapers.data, stashConfig]);
|
||||||
|
|
||||||
|
// set the current source on load
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!sources.length || currentSource) {
|
if (!sources.length || currentSource) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -191,8 +192,13 @@ export const TaggerContext: React.FC = ({ children }) => {
|
||||||
setCurrentSource(sources[0]);
|
setCurrentSource(sources[0]);
|
||||||
}, [sources, currentSource, config]);
|
}, [sources, currentSource, config]);
|
||||||
|
|
||||||
|
// clear the search results when the source changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setSearchResults({});
|
setSearchResults({});
|
||||||
|
}, [currentSource]);
|
||||||
|
|
||||||
|
// keep selected endpoint in config in sync with current source
|
||||||
|
useEffect(() => {
|
||||||
const selectedEndpoint = currentSource?.sourceInput.stash_box_endpoint;
|
const selectedEndpoint = currentSource?.sourceInput.stash_box_endpoint;
|
||||||
if (selectedEndpoint && selectedEndpoint !== config.selectedEndpoint) {
|
if (selectedEndpoint && selectedEndpoint !== config.selectedEndpoint) {
|
||||||
setConfig({
|
setConfig({
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue