mirror of
https://github.com/immich-app/immich.git
synced 2025-12-17 09:13:17 +03:00
chore(web): cleanup promise handling (#7382)
* no-misused-promises * no-floating-promises * format * revert for now * remove load function * require-await * revert a few no-floating-promises changes that would cause no-misused-promises failures * format * fix a few more * fix most remaining errors * executor-queue * executor-queue.spec * remove duplicate comments by grouping rules * upgrade sveltekit and enforce rules * oops. move await * try this * just ignore for now since it's only a test * run in parallel * Update web/src/routes/admin/jobs-status/+page.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * remove Promise.resolve call * rename function * remove unnecessary warning silencing * make handleError sync * fix new errors from recently merged PR to main * extract method * use handlePromiseError --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
import SearchFilterBox from './search-filter-box.svelte';
|
||||
import type { MetadataSearchDto, SmartSearchDto } from '@immich/sdk';
|
||||
import { getMetadataSearchQuery } from '$lib/utils/metadata-search';
|
||||
import { handlePromiseError } from '$lib/utils';
|
||||
|
||||
export let value = '';
|
||||
export let grayTheme: boolean;
|
||||
@@ -21,13 +22,13 @@
|
||||
let showFilter = false;
|
||||
$: showClearIcon = value.length > 0;
|
||||
|
||||
const onSearch = (payload: SmartSearchDto | MetadataSearchDto) => {
|
||||
const onSearch = async (payload: SmartSearchDto | MetadataSearchDto) => {
|
||||
const params = getMetadataSearchQuery(payload);
|
||||
|
||||
showHistory = false;
|
||||
showFilter = false;
|
||||
$isSearchEnabled = false;
|
||||
goto(`${AppRoute.SEARCH}?${params}`);
|
||||
await goto(`${AppRoute.SEARCH}?${params}`);
|
||||
};
|
||||
|
||||
const clearSearchTerm = (searchTerm: string) => {
|
||||
@@ -63,9 +64,9 @@
|
||||
showFilter = false;
|
||||
};
|
||||
|
||||
const onHistoryTermClick = (searchTerm: string) => {
|
||||
const onHistoryTermClick = async (searchTerm: string) => {
|
||||
const searchPayload = { query: searchTerm };
|
||||
onSearch(searchPayload);
|
||||
await onSearch(searchPayload);
|
||||
};
|
||||
|
||||
const onFilterClick = () => {
|
||||
@@ -78,7 +79,7 @@
|
||||
};
|
||||
|
||||
const onSubmit = () => {
|
||||
onSearch({ query: value });
|
||||
handlePromiseError(onSearch({ query: value }));
|
||||
saveSearchTerm(value);
|
||||
};
|
||||
</script>
|
||||
@@ -141,7 +142,7 @@
|
||||
<SearchHistoryBox
|
||||
on:clearAllSearchTerms={clearAllSearchTerms}
|
||||
on:clearSearchTerm={({ detail: searchTerm }) => clearSearchTerm(searchTerm)}
|
||||
on:selectSearchTerm={({ detail: searchTerm }) => onHistoryTermClick(searchTerm)}
|
||||
on:selectSearchTerm={({ detail: searchTerm }) => handlePromiseError(onHistoryTermClick(searchTerm))}
|
||||
/>
|
||||
{/if}
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user