Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix infinite loading of quickstart templates #527

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions src/lib/wizards/functions/cover.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -106,31 +106,32 @@
</li>
{/each}
{:then response}
{@const runtimes = response.runtimes}
{#each quickStart.runtimes.filter((_template, index) => index < 6) as runtime}
{@const runtimeDetail = runtimes.find(
(r) => r.$id === runtime.name
)}
{@const runtimes = new Map(response.runtimes.map((r) => [r.$id, r]))}
{@const templates = quickStart.runtimes.filter((_template) =>
runtimes.has(_template.name)
)}
{#each templates.slice(0, 6) as template}
{@const runtimeDetail = runtimes.get(template.name)}
<li>
<button
on:click={() => {
trackEvent('click_connect_template', {
from: 'cover',
template: quickStart.id,
runtime: runtime.name
runtime: template.name
});
}}
on:click={() => connectTemplate(quickStart, runtime.name)}
on:click={() => connectTemplate(quickStart, template.name)}
class="box u-width-full-line u-flex u-cross-center u-gap-8"
style:--box-padding="1rem"
style:--box-border-radius="var(--border-radius-small)">
<div class="avatar is-size-small">
<img
style:--p-text-size="1.25rem"
src={`${base}/icons/${$app.themeInUse}/color/${
runtime.name.split('-')[0]
template.name.split('-')[0]
}.svg`}
alt={runtime.name} />
alt={template.name} />
</div>
<div class="body-text-2">
{runtimeDetail.name}
Expand All @@ -139,7 +140,7 @@
</li>
{/each}

{#if quickStart.runtimes.length < 6}
{#if templates.length < 6}
<li
use:tooltip={{
content: 'More runtimes coming soon'
Expand Down