Lib: Use Promise.all for nested {#await} blocks
All checks were successful
Build Formula11 Docker Image / pocketbase-docker (push) Successful in 31s

This commit is contained in:
2025-02-05 22:20:37 +01:00
parent 894ad9aaa6
commit 5f43c9ac52
3 changed files with 175 additions and 187 deletions

View File

@ -88,8 +88,7 @@
let dnf_select_value: string = $state(racepick?.dnf ?? "");
</script>
{#await data.graphics then graphics}
{#await data.drivers then drivers}
{#await Promise.all([data.graphics, data.drivers]) then [graphics, drivers]}
<Card
imgsrc={get_by_value<Driver>(drivers, "id", racepick?.pxx ?? "")?.headshot_url ??
get_driver_headshot_template(graphics)}
@ -156,13 +155,7 @@
>
Save Changes
</Button>
<Button
formaction="?/delete_racepick"
color="primary"
{disabled}
submit
width="w-1/2"
>
<Button formaction="?/delete_racepick" color="primary" {disabled} submit width="w-1/2">
Delete
</Button>
{:else}
@ -181,4 +174,3 @@
</form>
</Card>
{/await}
{/await}

View File

@ -172,8 +172,7 @@
<div class="mt-2 flex flex-col gap-2">
<!-- PXXs autocomplete chips -->
{#await currentrace then current}
{#await pxxs_whitelist then whitelist}
{#await Promise.all([currentrace, pxxs_whitelist]) then [current, whitelist]}
<InputChip
bind:input={pxxs_input}
bind:value={pxxs_chips}
@ -186,7 +185,6 @@
on:remove={on_pxxs_chip_remove}
/>
{/await}
{/await}
<div class="card max-h-48 w-full overflow-y-auto p-2" tabindex="-1">
{#await pxxs_options then options}
<Autocomplete

View File

@ -56,8 +56,7 @@
let race_select_value: string = $state(substitution?.race ?? "");
</script>
{#await data.graphics then graphics}
{#await data.drivers then drivers}
{#await Promise.all([data.graphics, data.drivers]) then [graphics, drivers]}
<Card
imgsrc={get_by_value<Driver>(drivers, "id", substitution?.substitute ?? "")?.headshot_url ??
get_driver_headshot_template(graphics)}
@ -156,4 +155,3 @@
</form>
</Card>
{/await}
{/await}