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 loading state bug when creating new workspace #18870

Merged
merged 2 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,16 @@ export const useUnifiedRepositorySearch = ({ searchString }: { searchString: str
const searchQuery = useSearchRepositories({ searchString });

const filteredRepos = useMemo(() => {
const repoMap = new Map<string, SuggestedRepository>((suggestedQuery.data || []).map((r) => [r.url, r]));
const repoMap = new Map<string, SuggestedRepository>(
(suggestedQuery.data || []).map((r) => [`${r.url}:${r.projectId || ""}`, r]),
);

// Merge the search results into the suggested results
for (const repo of searchQuery.data || []) {
if (!repoMap.has(repo.url)) {
repoMap.set(repo.url, repo);
const key = `${repo.url}:${repo.projectId || ""}`;

if (!repoMap.has(key)) {
repoMap.set(key, repo);
}
}

Expand Down
4 changes: 2 additions & 2 deletions components/dashboard/src/workspaces/CreateWorkspacePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ export function CreateWorkspacePage() {
selectedIdeOption={selectedIde}
useLatest={useLatestIde}
disabled={createWorkspaceMutation.isStarting}
loading={workspaceContext.isLoading || !optionsLoaded}
loading={workspaceContext.isLoading}
/>
</InputField>

Expand All @@ -408,7 +408,7 @@ export function CreateWorkspacePage() {
setError={setErrorWsClass}
selectedWorkspaceClass={selectedWsClass}
disabled={createWorkspaceMutation.isStarting}
loading={workspaceContext.isLoading || !optionsLoaded}
loading={workspaceContext.isLoading}
/>
</InputField>
</div>
Expand Down