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

View File

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

View File

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