@@ -41,7 +41,13 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio
41
41
const { t } = useTranslation ( 'stdcm' ) ;
42
42
const dispatch = useAppDispatch ( ) ;
43
43
44
- const { searchTerm, setSearchTerm, searchResults, setSearchResults } = useSearchOperationalPoint ( {
44
+ const {
45
+ searchTerm,
46
+ setSearchTerm,
47
+ searchResults,
48
+ setSearchResults,
49
+ searchOperationalPointsByTrigram,
50
+ } = useSearchOperationalPoint ( {
45
51
initialSearchTerm : location ?. name ,
46
52
initialChCodeFilter : location ?. secondary_code ,
47
53
isStdcm : true ,
@@ -98,14 +104,17 @@ const StdcmOperationalPoint = ({ location, pathStepId, disabled }: StdcmOperatio
98
104
[ searchResults ]
99
105
) ;
100
106
101
- const handleCiSelect = ( selectedSuggestion ?: CIOption ) => {
107
+ const handleCiSelect = async ( selectedSuggestion ?: CIOption ) => {
108
+ dispatch ( updateStdcmPathStep ( { id : pathStepId , updates : { location : selectedSuggestion } } ) ) ;
102
109
if ( selectedSuggestion ) {
103
- const newChSuggestions = extractChCodes ( searchResults , selectedSuggestion ) ;
110
+ const operationalPointParts = await searchOperationalPointsByTrigram (
111
+ selectedSuggestion . trigram
112
+ ) ;
113
+ const newChSuggestions = extractChCodes ( operationalPointParts , selectedSuggestion ) ;
104
114
setChSuggestions ( newChSuggestions ) ;
105
115
} else {
106
116
setChSuggestions ( [ ] ) ;
107
117
}
108
- dispatch ( updateStdcmPathStep ( { id : pathStepId , updates : { location : selectedSuggestion } } ) ) ;
109
118
} ;
110
119
111
120
const handleChSelect = ( selectedChCode ?: CHOption ) => {
0 commit comments