File tree Expand file tree Collapse file tree 2 files changed +8
-3
lines changed
Expand file tree Collapse file tree 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -374,7 +374,7 @@ export default function Feed(): React.ReactElement {
374374 onSubmit = { ( event ) => {
375375 event . preventDefault ( ) ;
376376 setActivePagination ( 1 ) ;
377- setActiveSearch ( searchQuery ) ;
377+ setActiveSearch ( searchQuery . trim ( ) ) ;
378378 } }
379379 sx = { searchBarStyles }
380380 >
@@ -395,7 +395,7 @@ export default function Feed(): React.ReactElement {
395395 } }
396396 onClick = { ( ) => {
397397 setActivePagination ( 1 ) ;
398- setActiveSearch ( searchQuery ) ;
398+ setActiveSearch ( searchQuery . trim ( ) ) ;
399399 } }
400400 position = 'start'
401401 >
Original file line number Diff line number Diff line change @@ -57,7 +57,12 @@ function Component(): React.ReactElement {
5757 const theme = useTheme ( ) ;
5858
5959 const handleSearch = ( ) : void => {
60- navigate ( `/feeds?q=${ encodeURIComponent ( searchInputValue ) } ` ) ;
60+ const encodedURI = encodeURIComponent ( searchInputValue . trim ( ) ) ;
61+ if ( encodedURI . length === 0 ) {
62+ navigate ( '/feeds' ) ;
63+ } else {
64+ navigate ( `/feeds?q=${ encodedURI } ` ) ;
65+ }
6166 } ;
6267
6368 const handleKeyDown = (
You can’t perform that action at this time.
0 commit comments