@@ -47,7 +47,6 @@ import { type components } from '#generated/types';
4747import useCountry from '#hooks/domain/useCountry' ;
4848import useDisasterTypes , { type DisasterType } from '#hooks/domain/useDisasterType' ;
4949import useGlobalEnums from '#hooks/domain/useGlobalEnums' ;
50- import usePerComponent from '#hooks/domain/usePerComponent' ;
5150import useSecondarySector from '#hooks/domain/useSecondarySector' ;
5251import useAlert from '#hooks/useAlert' ;
5352import useFilterState from '#hooks/useFilterState' ;
@@ -132,7 +131,21 @@ export function Component() {
132131 const countryList = useCountry ( { region : rawFilter . region } ) ;
133132 const disasterTypeOptions = useDisasterTypes ( ) ;
134133 const secondarySectorOptions = useSecondarySector ( ) ;
135- const perComponentOptions = usePerComponent ( ) ;
134+ const {
135+ response : perComponentsResponse ,
136+ } = useRequest ( {
137+ url : '/api/v2/per-formcomponent/' ,
138+ query : {
139+ exclude_subcomponents : true ,
140+ } ,
141+ preserveResponse : true ,
142+ onFailure : ( ) => {
143+ alert . show (
144+ strings . failedToFetchPerComponents ,
145+ { variant : 'danger' } ,
146+ ) ;
147+ } ,
148+ } ) ;
136149
137150 const {
138151 pending : opsLearningSummaryPending ,
@@ -361,7 +374,7 @@ export function Component() {
361374 onChange = { onFilterChange }
362375 disasterTypeOptions = { disasterTypeOptions }
363376 secondarySectorOptions = { secondarySectorOptions }
364- perComponentOptions = { perComponentOptions }
377+ perComponentOptions = { perComponentsResponse ?. results }
365378 organizationTypeOptions = { opsLearningOrganizationTypes ?. results }
366379 perLearningTypeOptions = { perLearningTypeOptions }
367380 organizationTypePending = { opsLearningOrganizationTypePending }
@@ -415,7 +428,7 @@ export function Component() {
415428 name = "perComponents"
416429 onDismiss = { onFilterChange }
417430 value = { rawFilter . perComponents }
418- options = { perComponentOptions }
431+ options = { perComponentsResponse ?. results }
419432 labelSelector = { getFormattedComponentName }
420433 keySelector = { numericIdSelector }
421434 />
0 commit comments