Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions src/pages/Search/SearchSavePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,16 +83,14 @@
function SearchSavePage() {
const styles = useThemeStyles();
const {translate, localeCompare} = useLocalize();
const [savedSearches] = useOnyx(ONYXKEYS.SAVED_SEARCHES);

Check failure on line 86 in src/pages/Search/SearchSavePage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'savedSearches' is assigned a value but never used

Check failure on line 86 in src/pages/Search/SearchSavePage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

'savedSearches' is assigned a value but never used

Check failure on line 86 in src/pages/Search/SearchSavePage.tsx

View workflow job for this annotation

GitHub Actions / ESLint check

'savedSearches' is assigned a value but never used
const [searchAdvancedFiltersForm = getEmptyObject<Partial<SearchAdvancedFiltersForm>>()] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM);
const [name, setName] = useState('');

const {currentSearchQueryJSON} = useSearchStateContext();

const onSaveSearch = () => {
const savedSearchKeys = Object.keys(savedSearches ?? {});
if (!currentSearchQueryJSON || (savedSearches && savedSearchKeys.includes(String(currentSearchQueryJSON.hash)))) {
// If the search is already saved, we only display the results as we don't need to save it.
if (!currentSearchQueryJSON) {
Navigation.goBack();
return;
}
Expand All @@ -102,6 +100,7 @@
} else {
saveSearch({queryJSON: currentSearchQueryJSON});
Comment thread
JS00001 marked this conversation as resolved.
Outdated
}

Navigation.goBack();
};

Expand Down
Loading