@@ -91,24 +91,7 @@ export const OrganizationListPage = withCardStateProvider(() => {
91
91
92
92
return (
93
93
< FlowCard >
94
- { isLoading && (
95
- < Flex
96
- direction = { 'row' }
97
- align = { 'center' }
98
- justify = { 'center' }
99
- sx = { t => ( {
100
- height : '100%' ,
101
- minHeight : t . sizes . $60 ,
102
- } ) }
103
- >
104
- < Spinner
105
- size = { 'lg' }
106
- colorScheme = { 'primary' }
107
- elementDescriptor = { descriptors . spinner }
108
- />
109
- </ Flex >
110
- ) }
111
-
94
+ { isLoading && < FlowLoadingState /> }
112
95
{ ! isLoading && < OrganizationListFlows showListInitially = { ! ( hidePersonal && ! hasAnyData ) } /> }
113
96
</ FlowCard >
114
97
) ;
@@ -233,29 +216,16 @@ const ForceOrganizationSelectionFlow = () => {
233
216
const { navigateAfterCreateOrganization, hideSlug } = useOrganizationListContext ( ) ;
234
217
const { userMemberships, userSuggestions, userInvitations } = useOrganizationListInView ( ) ;
235
218
236
- const [ isNavigating , setIsNavigating ] = useState ( false ) ;
237
- const isLoading = isNavigating || ! ! ( userMemberships ?. count || userInvitations ?. count || userSuggestions ?. count ) ;
219
+ const [ isNavigatingAfterOrgCreation , setIsNavigatingAfterOrgCreation ] = useState ( false ) ;
220
+ const isLoading =
221
+ isNavigatingAfterOrgCreation || ! ! ( userMemberships ?. count || userInvitations ?. count || userSuggestions ?. count ) ;
238
222
239
223
const [ isCreateOrganizationFlow , setIsCreateOrganizationFlow ] = useState ( ! userMemberships ?. data ?. length ) ;
240
224
241
225
if ( isLoading ) {
242
226
return (
243
227
< FlowCard >
244
- < Flex
245
- direction = { 'row' }
246
- align = { 'center' }
247
- justify = { 'center' }
248
- sx = { t => ( {
249
- height : '100%' ,
250
- minHeight : t . sizes . $60 ,
251
- } ) }
252
- >
253
- < Spinner
254
- size = { 'lg' }
255
- colorScheme = { 'primary' }
256
- elementDescriptor = { descriptors . spinner }
257
- />
258
- </ Flex >
228
+ < FlowLoadingState />
259
229
</ FlowCard >
260
230
) ;
261
231
}
@@ -274,7 +244,9 @@ const ForceOrganizationSelectionFlow = () => {
274
244
startPage = { { headerTitle : localizationKeys ( 'organizationList.createOrganization' ) } }
275
245
skipInvitationScreen
276
246
navigateAfterCreateOrganization = { org => {
277
- setIsNavigating ( true ) ;
247
+ // During a force organization selection flow, keep displaying the creation form in a loading state.
248
+ // This allows the client-side navigation to complete before transitioning away from this view.
249
+ setIsNavigatingAfterOrgCreation ( true ) ;
278
250
return navigateAfterCreateOrganization ( org ) ;
279
251
} }
280
252
hideSlug = { hideSlug }
@@ -300,3 +272,21 @@ const FlowCard = ({ children }: PropsWithChildren) => {
300
272
</ Card . Root >
301
273
) ;
302
274
} ;
275
+
276
+ const FlowLoadingState = ( ) => (
277
+ < Flex
278
+ direction = { 'row' }
279
+ align = { 'center' }
280
+ justify = { 'center' }
281
+ sx = { t => ( {
282
+ height : '100%' ,
283
+ minHeight : t . sizes . $60 ,
284
+ } ) }
285
+ >
286
+ < Spinner
287
+ size = { 'lg' }
288
+ colorScheme = { 'primary' }
289
+ elementDescriptor = { descriptors . spinner }
290
+ />
291
+ </ Flex >
292
+ ) ;
0 commit comments