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:
Ben McCann
2024-02-27 08:37:37 -08:00
committed by GitHub
parent 57f25855d3
commit 907a95a746
70 changed files with 312 additions and 282 deletions
+5 -4
View File
@@ -35,6 +35,7 @@
import type { Viewport } from '$lib/stores/assets.store';
import { locale } from '$lib/stores/preferences.store';
import LoadingSpinner from '$lib/components/shared-components/loading-spinner.svelte';
import { handlePromiseError } from '$lib/utils';
import { parseUtcDate } from '$lib/utils/date-time';
const MAX_ASSET_COUNT = 5000;
@@ -53,7 +54,7 @@
const onKeyboardPress = (event: KeyboardEvent) => handleKeyboardPress(event);
const handleKeyboardPress = (event: KeyboardEvent) => {
const handleKeyboardPress = async (event: KeyboardEvent) => {
if (shouldIgnoreShortcut(event)) {
return;
}
@@ -65,7 +66,7 @@
return;
}
if (!$preventRaceConditionSearchBar) {
goto(previousRoute);
await goto(previousRoute);
}
$preventRaceConditionSearchBar = false;
return;
@@ -108,13 +109,13 @@
return searchQuery ? JSON.parse(searchQuery) : {};
})();
$: terms, onSearchQueryUpdate();
$: terms, handlePromiseError(onSearchQueryUpdate());
async function onSearchQueryUpdate() {
nextPage = 1;
searchResultAssets = [];
searchResultAlbums = [];
loadNextPage();
await loadNextPage();
}
export const loadNextPage = async () => {