Skip to content

Commit 67b26eb

Browse files
[dashboard] Fix org-suggested repositories when settings org query is fetching (#20649)
Tool: gitpod/catfood.gitpod.cloud
1 parent 61ecd26 commit 67b26eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

components/dashboard/src/data/organizations/suggested-repositories-query.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ export type SuggestedOrgRepository = PlainMessage<SuggestedRepository> & {
2828

2929
export function useOrgSuggestedRepos() {
3030
const organizationId = useCurrentOrg().data?.id;
31-
const orgSettings = useOrgSettingsQuery();
31+
const { data: orgSettings, isLoading: isOrgSettingsLoading } = useOrgSettingsQuery();
3232

3333
const query = useQuery<SuggestedOrgRepository[], Error>(
3434
getQueryKey(organizationId),
3535
async () => {
36-
const repos = orgSettings.data?.onboardingSettings?.recommendedRepositories ?? [];
36+
const repos = orgSettings?.onboardingSettings?.recommendedRepositories ?? [];
3737

3838
const suggestions: SuggestedOrgRepository[] = [];
3939
for (const configurationId of repos) {
@@ -58,7 +58,7 @@ export function useOrgSuggestedRepos() {
5858
return suggestions;
5959
},
6060
{
61-
enabled: !!organizationId,
61+
enabled: !!organizationId && !isOrgSettingsLoading,
6262
cacheTime: 1000 * 60 * 60 * 24 * 7, // 1 week
6363
staleTime: 1000 * 60 * 5, // 5 minutes
6464
},

0 commit comments

Comments
 (0)