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:
@@ -15,6 +15,7 @@
|
||||
import { DateTime, Duration } from 'luxon';
|
||||
import { onDestroy, onMount } from 'svelte';
|
||||
import type { PageData } from './$types';
|
||||
import { handlePromiseError } from '$lib/utils';
|
||||
|
||||
export let data: PageData;
|
||||
|
||||
@@ -26,8 +27,8 @@
|
||||
let viewingAssetCursor = 0;
|
||||
let showSettingsModal = false;
|
||||
|
||||
onMount(() => {
|
||||
loadMapMarkers().then((data) => (mapMarkers = data));
|
||||
onMount(async () => {
|
||||
mapMarkers = await loadMapMarkers();
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
@@ -35,7 +36,7 @@
|
||||
assetViewingStore.showAssetViewer(false);
|
||||
});
|
||||
|
||||
$: $featureFlags.map || goto(AppRoute.PHOTOS);
|
||||
$: $featureFlags.map || handlePromiseError(goto(AppRoute.PHOTOS));
|
||||
const omit = (obj: MapSettings, key: string) => {
|
||||
return Object.fromEntries(Object.entries(obj).filter(([k]) => k !== key));
|
||||
};
|
||||
@@ -85,21 +86,21 @@
|
||||
}
|
||||
}
|
||||
|
||||
function onViewAssets(assetIds: string[]) {
|
||||
assetViewingStore.setAssetId(assetIds[0]);
|
||||
async function onViewAssets(assetIds: string[]) {
|
||||
await assetViewingStore.setAssetId(assetIds[0]);
|
||||
viewingAssets = assetIds;
|
||||
viewingAssetCursor = 0;
|
||||
}
|
||||
|
||||
function navigateNext() {
|
||||
async function navigateNext() {
|
||||
if (viewingAssetCursor < viewingAssets.length - 1) {
|
||||
assetViewingStore.setAssetId(viewingAssets[++viewingAssetCursor]);
|
||||
await assetViewingStore.setAssetId(viewingAssets[++viewingAssetCursor]);
|
||||
}
|
||||
}
|
||||
|
||||
function navigatePrevious() {
|
||||
async function navigatePrevious() {
|
||||
if (viewingAssetCursor > 0) {
|
||||
assetViewingStore.setAssetId(viewingAssets[--viewingAssetCursor]);
|
||||
await assetViewingStore.setAssetId(viewingAssets[--viewingAssetCursor]);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user