Skip to content

Commit 9696bf5

Browse files
committed
Removing await function to fix the combobox select options
1 parent 2487e68 commit 9696bf5

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/lib/components/git/repositories.svelte

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import { page } from '$app/state';
2424
import Card from '../card.svelte';
2525
import SkeletonRepoList from './skeletonRepoList.svelte';
26-
import { untrack } from 'svelte';
26+
import { onMount, untrack } from 'svelte';
2727
2828
let {
2929
action = $bindable('select'),
@@ -46,6 +46,11 @@
4646
let search = $state('');
4747
let selectedInstallation = $state(null);
4848
let isLoadingRepositories = $state(null);
49+
let installationsMap = $state(null);
50+
51+
onMount(() => {
52+
loadInstallations();
53+
});
4954
5055
async function loadInstallations() {
5156
if (installationList) {
@@ -59,7 +64,7 @@
5964
)
6065
);
6166
}
62-
return installationList.installations;
67+
installationsMap = installationList.installations;
6368
} else {
6469
const { installations } = await sdk
6570
.forProject(page.params.region, page.params.project)
@@ -70,7 +75,7 @@
7075
}
7176
installation.set(installations.find((entry) => entry.$id === selectedInstallation));
7277
}
73-
return installations;
78+
installationsMap = installations;
7479
}
7580
}
7681
@@ -123,7 +128,7 @@
123128
{#if hasInstallations}
124129
<Layout.Stack>
125130
<Layout.Stack gap="s">
126-
{#await loadInstallations()}
131+
{#if !installationsMap}
127132
<Layout.Stack direction="row">
128133
<InputSelect
129134
disabled
@@ -137,12 +142,12 @@
137142
value={null} />
138143
<InputSearch placeholder="Search repositories" disabled />
139144
</Layout.Stack>
140-
{:then installations}
145+
{:else}
141146
<Layout.Stack direction={$isSmallViewport ? 'column' : 'row'}>
142147
<InputSelect
143148
id="installation"
144149
options={[
145-
...installations.map((entry) => {
150+
...installationsMap.map((entry) => {
146151
return {
147152
label: entry.organization,
148153
value: entry.$id
@@ -160,7 +165,7 @@
160165
}
161166
search = '';
162167
installation.set(
163-
installations.find((entry) => entry.$id === selectedInstallation)
168+
installationsMap.find((entry) => entry.$id === selectedInstallation)
164169
);
165170

166171
isLoadingRepositories = true;
@@ -174,7 +179,7 @@
174179
bind:value={search}
175180
disabled={!search && !$repositories?.repositories?.length} />
176181
</Layout.Stack>
177-
{/await}
182+
{/if}
178183
</Layout.Stack>
179184
{#if selectedInstallation}
180185
<!-- manual installation change -->
@@ -310,3 +315,4 @@
310315
{:else}
311316
<ConnectGit {callbackState} />
312317
{/if}
318+
hai hoi

0 commit comments

Comments
 (0)