@@ -114,30 +114,28 @@ export function Component() {
114114
115115 const [ positionFilter , setPositionFilter ] = useUrlSearchState < string | undefined > (
116116 'position' ,
117- ( searchValue : string | undefined ) => {
118- const potentialValue = isDefined ( searchValue )
119- ? String ( searchValue )
120- : undefined ;
121- if ( isDefined ( potentialValue ) ) {
117+ ( value ) => {
118+ const v = value == null ? undefined : String ( value ) ;
119+ const normalized = v && v . trim ( ) ? v . trim ( ) : undefined ;
120+ if ( isDefined ( normalized ) ) {
122121 setPage ( 0 ) ;
123122 }
124- return potentialValue ;
123+ return normalized ;
125124 } ,
126- ( position : string | undefined ) => position ,
125+ ( position ) => position ?? undefined ,
127126 ) ;
128127
129128 const [ keywordsFilter , setKeywordsFilter ] = useUrlSearchState < string | undefined > (
130129 'keywords' ,
131- ( searchValue : string | undefined ) => {
132- const potentialValue = isDefined ( searchValue )
133- ? String ( searchValue )
134- : undefined ;
135- if ( isDefined ( potentialValue ) ) {
130+ ( value ) => {
131+ const v = value == null ? undefined : String ( value ) ;
132+ const normalized = v && v . trim ( ) ? v . trim ( ) : undefined ;
133+ if ( isDefined ( normalized ) ) {
136134 setPage ( 0 ) ;
137135 }
138- return potentialValue ;
136+ return normalized ;
139137 } ,
140- ( keywords : string | undefined ) => keywords ,
138+ ( keywords ) => keywords ?? undefined ,
141139 ) ;
142140
143141 useRequest ( {
@@ -193,8 +191,7 @@ export function Component() {
193191 country : countryFilter ,
194192 message__icontains : positionFilter ,
195193 molnix_tag_name : keywordsFilter ,
196-
197- // FIXME: this should come from the useFilterState
194+ // FIXME: this should come from useFilterState
198195 ordering : 'molnix_status,-opens' ,
199196 } ,
200197 } ) ;
0 commit comments