Skip to content

Commit e3b9f37

Browse files
committed
fix(account): fix refresh list on add repo
1 parent bafb230 commit e3b9f37

File tree

3 files changed

+20
-26
lines changed

3 files changed

+20
-26
lines changed

package-lock.json

-13
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/components/AzureDevOps/AzureDevOps.svelte

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { Service } from 'services/Service';
33
import { clientAuthenticated } from 'shared/stores/authentication.store';
4-
import { isFetchingData, isLoading } from 'shared/stores/default.store';
4+
import { isLoading } from 'shared/stores/default.store';
55
import { authorize } from 'shared/token';
66
import { ProviderEnum } from 'models/skizzle/ProviderEnum';
77
import AccountTitle from 'components/AccountTitle';
@@ -14,18 +14,22 @@
1414
1515
let search: string = '';
1616
17-
const onSearchSubmit = (profile: ProfileType) => async (
18-
query: string,
19-
) => {
17+
let isLoadingRepositories = false;
18+
const onSearchSubmit = (profile: ProfileType) => async (query: string) => {
2019
search = query;
2120
22-
const result = await Service.getRepositories(ProviderEnum.AzureDevOps, { profile });
21+
isLoadingRepositories = true;
22+
const result = await Service.getRepositories(ProviderEnum.AzureDevOps, {
23+
profile,
24+
});
2325
2426
fetchedAzureDevOpsRepositories = result.filter(
2527
({ projectName, name }) =>
2628
name.toLocaleLowerCase().includes(search.toLocaleLowerCase()) ||
2729
projectName.toLocaleLowerCase().includes(search.toLocaleLowerCase()),
2830
);
31+
32+
isLoadingRepositories = false;
2933
};
3034
3135
const onSearchCancel = (): void => {
@@ -48,18 +52,16 @@
4852
<div class="content">
4953
<section>
5054
<AccountTitle>Suivre un nouveau repository</AccountTitle>
51-
<p class="intro">
52-
Cherchez le nom de son projet et/ou repository associé.
53-
</p>
55+
<p class="intro">Cherchez le nom de son projet et/ou repository associé.</p>
5456
<Search
5557
onSubmit={onSearchSubmit(profile)}
5658
onCancel={onSearchCancel}
57-
disabled={$isFetchingData}
59+
disabled={isLoadingRepositories}
5860
placeholder="Rechercher un projet ou un repos"
5961
/>
6062

6163
{#if search}
62-
{#if $isFetchingData}
64+
{#if isLoadingRepositories}
6365
<p>Recherche en cours...</p>
6466
{:else}
6567
<SearchResults {search} repos={fetchedAzureDevOpsRepositories} />

src/components/Github/Github.svelte

+8-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script lang="ts">
22
import { Service } from 'services/Service';
33
import { clientAuthenticated } from 'shared/stores/authentication.store';
4-
import { isFetchingData, isLoading } from 'shared/stores/default.store';
4+
import { isLoading } from 'shared/stores/default.store';
55
import { authorize } from 'shared/token';
66
import { ProviderEnum } from 'models/skizzle/ProviderEnum';
77
import AccountTitle from 'components/AccountTitle';
@@ -13,17 +13,22 @@
1313
import type { RepositoryType } from 'models/skizzle';
1414
1515
let search: string = '';
16+
let isLoadingRepositories = false;
1617
1718
$: fetchedGithubRepositories = [] as RepositoryType[];
1819
1920
const onSearchSubmit = async (query: string) => {
21+
isLoadingRepositories = true;
22+
2023
search = query;
2124
fetchedGithubRepositories = await Service.getRepositories(
2225
ProviderEnum.Github,
2326
{
2427
query,
2528
},
2629
);
30+
31+
isLoadingRepositories = false;
2732
};
2833
2934
const onSearchCancel = () => {
@@ -49,12 +54,12 @@
4954
<Search
5055
onSubmit={onSearchSubmit}
5156
onCancel={onSearchCancel}
52-
disabled={$isFetchingData}
57+
disabled={isLoadingRepositories}
5358
placeholder="Rechercher un repository"
5459
/>
5560

5661
{#if search}
57-
{#if $isFetchingData}
62+
{#if isLoadingRepositories}
5863
<p>Recherche en cours...</p>
5964
{:else}
6065
<SearchResults {search} repos={fetchedGithubRepositories} />

0 commit comments

Comments
 (0)