@@ -49,7 +49,6 @@ const CreateOrganizationButton = ({
4949} ;
5050
5151export const OrganizationListPage = withCardStateProvider ( ( ) => {
52- const card = useCardState ( ) ;
5352 const { userMemberships, userSuggestions, userInvitations } = useOrganizationListInView ( ) ;
5453 const isLoading = userMemberships ?. isLoading || userInvitations ?. isLoading || userSuggestions ?. isLoading ;
5554 const hasAnyData = ! ! ( userMemberships ?. count || userInvitations ?. count || userSuggestions ?. count ) ;
@@ -59,7 +58,6 @@ export const OrganizationListPage = withCardStateProvider(() => {
5958 return (
6059 < Card . Root >
6160 < Card . Content sx = { t => ( { padding : `${ t . space . $8 } ${ t . space . $none } ${ t . space . $none } ` } ) } >
62- < Card . Alert sx = { t => ( { margin : `${ t . space . $none } ${ t . space . $5 } ` } ) } > { card . error } </ Card . Alert >
6361 { isLoading && (
6462 < Flex
6563 direction = { 'row' }
@@ -86,6 +84,7 @@ export const OrganizationListPage = withCardStateProvider(() => {
8684} ) ;
8785
8886const OrganizationListFlows = ( { showListInitially } : { showListInitially : boolean } ) => {
87+ const card = useCardState ( ) ;
8988 const { navigateAfterCreateOrganization, skipInvitationScreen, hideSlug } = useOrganizationListContext ( ) ;
9089 const [ isCreateOrganizationFlow , setCreateOrganizationFlow ] = useState ( ! showListInitially ) ;
9190 return (
@@ -95,30 +94,35 @@ const OrganizationListFlows = ({ showListInitially }: { showListInitially: boole
9594 ) }
9695
9796 { isCreateOrganizationFlow && (
98- < Box
99- sx = { t => ( {
100- padding : `${ t . space . $none } ${ t . space . $5 } ${ t . space . $5 } ` ,
101- } ) }
102- >
103- < CreateOrganizationForm
104- flow = 'organizationList'
105- startPage = { { headerTitle : localizationKeys ( 'organizationList.createOrganization' ) } }
106- skipInvitationScreen = { skipInvitationScreen }
107- navigateAfterCreateOrganization = { org =>
108- navigateAfterCreateOrganization ( org ) . then ( ( ) => setCreateOrganizationFlow ( false ) )
109- }
110- onCancel = {
111- showListInitially && isCreateOrganizationFlow ? ( ) => setCreateOrganizationFlow ( false ) : undefined
112- }
113- hideSlug = { hideSlug }
114- />
115- </ Box >
97+ < >
98+ < Card . Alert sx = { t => ( { margin : `${ t . space . $none } ${ t . space . $5 } ` } ) } > { card . error } </ Card . Alert >
99+
100+ < Box
101+ sx = { t => ( {
102+ padding : `${ t . space . $none } ${ t . space . $5 } ${ t . space . $5 } ` ,
103+ } ) }
104+ >
105+ < CreateOrganizationForm
106+ flow = 'organizationList'
107+ startPage = { { headerTitle : localizationKeys ( 'organizationList.createOrganization' ) } }
108+ skipInvitationScreen = { skipInvitationScreen }
109+ navigateAfterCreateOrganization = { org =>
110+ navigateAfterCreateOrganization ( org ) . then ( ( ) => setCreateOrganizationFlow ( false ) )
111+ }
112+ onCancel = {
113+ showListInitially && isCreateOrganizationFlow ? ( ) => setCreateOrganizationFlow ( false ) : undefined
114+ }
115+ hideSlug = { hideSlug }
116+ />
117+ </ Box >
118+ </ >
116119 ) }
117120 </ >
118121 ) ;
119122} ;
120123
121124export const OrganizationListPageList = ( props : { onCreateOrganizationClick : ( ) => void } ) => {
125+ const card = useCardState ( ) ;
122126 const environment = useEnvironment ( ) ;
123127
124128 const { ref, userMemberships, userSuggestions, userInvitations } = useOrganizationListInView ( ) ;
@@ -128,6 +132,8 @@ export const OrganizationListPageList = (props: { onCreateOrganizationClick: ()
128132 const hasNextPage = userMemberships ?. hasNextPage || userInvitations ?. hasNextPage || userSuggestions ?. hasNextPage ;
129133
130134 const onCreateOrganizationClick = ( ) => {
135+ // Clear error originated from the list when switching to form
136+ card . setError ( undefined ) ;
131137 props . onCreateOrganizationClick ( ) ;
132138 } ;
133139
@@ -154,6 +160,7 @@ export const OrganizationListPageList = (props: { onCreateOrganizationClick: ()
154160 } ) }
155161 />
156162 </ Header . Root >
163+ < Card . Alert sx = { t => ( { margin : `${ t . space . $none } ${ t . space . $5 } ` } ) } > { card . error } </ Card . Alert >
157164 < Col elementDescriptor = { descriptors . main } >
158165 < PreviewListItems >
159166 < Actions role = 'menu' >
0 commit comments