File tree 1 file changed +6
-9
lines changed
components/dashboard/src/projects 1 file changed +6
-9
lines changed Original file line number Diff line number Diff line change @@ -90,27 +90,24 @@ export default function NewProject() {
90
90
}
91
91
( async ( ) => {
92
92
updateOrgsState ( ) ;
93
- const repos = await updateReposInAccounts ( ) ;
94
- const first = repos [ 0 ] ;
95
- if ( first ) {
96
- setSelectedAccount ( first . account ) ;
97
- }
98
- setLoaded ( true ) ;
93
+ await updateReposInAccounts ( ) ;
99
94
} ) ( ) ;
100
95
} , [ provider ] ) ;
101
96
102
97
const isGitHub = ( ) => provider === "github.com" ;
103
98
104
99
const updateReposInAccounts = async ( installationId ?: string ) => {
100
+ setLoaded ( false ) ;
101
+ setReposInAccounts ( [ ] ) ;
105
102
if ( ! provider ) {
106
103
return [ ] ;
107
104
}
108
105
try {
109
106
const repos = await getGitpodService ( ) . server . getProviderRepositoriesForUser ( { provider, hints : { installationId } } ) ;
110
107
setReposInAccounts ( repos ) ;
108
+ setLoaded ( true ) ;
111
109
return repos ;
112
110
} catch ( error ) {
113
- setReposInAccounts ( [ ] ) ;
114
111
console . log ( error ) ;
115
112
}
116
113
return [ ] ;
@@ -318,7 +315,7 @@ export default function NewProject() {
318
315
</ >
319
316
) ;
320
317
321
- const renderEmptyState = ( ) => ( < div >
318
+ const renderLoadingState = ( ) => ( < div >
322
319
< div className = "mt-8 border rounded-xl border-gray-100 dark:border-gray-700 flex-col" >
323
320
< div >
324
321
< div className = "px-12 py-16 text-center text-gray-500 bg-gray-50 dark:bg-gray-800 rounded-xl w-96 h-h96 flex items-center justify-center" >
@@ -339,7 +336,7 @@ export default function NewProject() {
339
336
}
340
337
341
338
if ( ! loaded ) {
342
- return renderEmptyState ( ) ;
339
+ return renderLoadingState ( ) ;
343
340
}
344
341
345
342
if ( showGitProviders ) {
You can’t perform that action at this time.
0 commit comments