From 4e08e37d745bc40d77a1d5596c531b7adb192e55 Mon Sep 17 00:00:00 2001 From: WithoutPants <53250216+WithoutPants@users.noreply.github.com> Date: Wed, 23 Jun 2021 13:00:58 +1000 Subject: [PATCH] Clear scene tagger results on new search (#1526) * Clear search results when searching in tagger * Fix oshash messageID --- ui/v2.5/src/components/Tagger/Tagger.tsx | 10 ++++++++++ ui/v2.5/src/models/list-filter/criteria/factory.ts | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Tagger/Tagger.tsx b/ui/v2.5/src/components/Tagger/Tagger.tsx index edd2ec67f..03ab99a5a 100755 --- a/ui/v2.5/src/components/Tagger/Tagger.tsx +++ b/ui/v2.5/src/components/Tagger/Tagger.tsx @@ -195,7 +195,17 @@ const TaggerList: React.FC = ({ inputForm?.current?.reset(); }, [config.mode, config.blacklist]); + function clearSceneSearchResult(sceneID: string) { + // remove sceneID results from the results object + const { [sceneID]: _removedResult, ...newSearchResults } = searchResults; + const { [sceneID]: _removedError, ...newSearchErrors } = searchErrors; + setSearchResults(newSearchResults); + setSearchErrors(newSearchErrors); + } + const doBoxSearch = (sceneID: string, searchVal: string) => { + clearSceneSearchResult(sceneID); + stashBoxSceneQuery(searchVal, selectedEndpoint.index) .then((queryData) => { const s = selectScenes(queryData.data?.queryStashBoxScene); diff --git a/ui/v2.5/src/models/list-filter/criteria/factory.ts b/ui/v2.5/src/models/list-filter/criteria/factory.ts index ddb946036..96ea5cd5e 100644 --- a/ui/v2.5/src/models/list-filter/criteria/factory.ts +++ b/ui/v2.5/src/models/list-filter/criteria/factory.ts @@ -49,7 +49,7 @@ export function makeCriteria(type: CriterionType = "none") { case "checksum": case "oshash": return new StringCriterion( - new MandatoryStringCriterionOption(type, type) + new MandatoryStringCriterionOption("media_info.hash", type, type) ); case "rating": return new NumberCriterion(RatingCriterionOption);