Skip to content

Commit 086c15d

Browse files
committed
fixup empty NewProject selection on Gitpod identity
1 parent 35164e5 commit 086c15d

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

components/dashboard/src/projects/NewProject.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,15 @@ export default function NewProject() {
5050

5151
useEffect(() => {
5252
if (user && authProviders && selectedProviderHost === undefined) {
53-
const candidate = user.identities[user.identities.length - 1];
54-
if (candidate) {
55-
const authProvider = authProviders.find((ap) => ap.authProviderId === candidate.authProviderId);
56-
const host = authProvider?.host;
57-
if (host) {
58-
setSelectedProviderHost(host);
53+
for (let i = user.identities.length - 1; i >= 0; i--) {
54+
const candidate = user.identities[i];
55+
if (candidate) {
56+
const authProvider = authProviders.find((ap) => ap.authProviderId === candidate.authProviderId);
57+
const host = authProvider?.host;
58+
if (host) {
59+
setSelectedProviderHost(host);
60+
break;
61+
}
5962
}
6063
}
6164
}

0 commit comments

Comments
 (0)