diff --git a/src/extensions/components/registration/agencySelection/AgencySelectionResults.tsx b/src/extensions/components/registration/agencySelection/AgencySelectionResults.tsx index 5c3b43f11..b7e5c8642 100644 --- a/src/extensions/components/registration/agencySelection/AgencySelectionResults.tsx +++ b/src/extensions/components/registration/agencySelection/AgencySelectionResults.tsx @@ -81,11 +81,7 @@ export const AgencySelectionResults = ({ return; } - if ( - // invalid agencyId, needs to be removed - selectedAgency && - results?.length === 0 - ) { + if (results?.length === 0) { setDisabledNextButton(true); onChange({ agency: undefined diff --git a/src/globalState/provider/RegistrationProvider.tsx b/src/globalState/provider/RegistrationProvider.tsx index e714e6a7f..b54b67e57 100644 --- a/src/globalState/provider/RegistrationProvider.tsx +++ b/src/globalState/provider/RegistrationProvider.tsx @@ -74,6 +74,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) { const { url } = useRouteMatch(); + const [loading, setLoading] = useState(true); const [disabledNextButton, setDisabledNextButton] = useState(true); const [hasTopicError, setHasTopicError] = useState(false); const [hasAgencyError, setHasAgencyError] = useState(false); @@ -144,6 +145,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) { (async () => { const registrationData = getSessionStorageData() as RegistrationData; + if (registrationData.mainTopicId) { registrationData.mainTopic = await apiGetTopicById( registrationData.mainTopicId @@ -161,6 +163,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) { ); } setRegistrationData(registrationData); + setLoading(false); })(); }, []); @@ -250,7 +253,7 @@ export function RegistrationProvider({ children }: PropsWithChildren<{}>) { ] ); - if (!loaded) return null; + if (!loaded || loading) return null; return (