Skip to content

Commit

Permalink
Merge pull request #520 from SCCapstone/493
Browse files Browse the repository at this point in the history
Set Page to 1 when theres new search text
  • Loading branch information
Jackson-Williams-15 authored Apr 14, 2024
2 parents 44c0a4c + cd5fdab commit 96f5a90
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion FU.SPA/src/components/pages/Discover.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,10 @@ export default function Discover() {
<div style={{ display: 'flex', gap: '50px', justifyContent: 'center' }}>
<TextSearch.SearchBar
searchText={searchText}
onSearchSubmit={setSearchText}
onSearchSubmit={(newSearchText) => {
setSearchText(newSearchText);
setPage(1);
}}
/>
{tabOption === tabOptions.Posts && renderPostSortSelector()}
{tabOption === tabOptions.Users && renderUserSortSelector()}
Expand Down
5 changes: 4 additions & 1 deletion FU.SPA/src/components/pages/Social.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,10 @@ export default function Social() {
<div style={{ display: 'flex', gap: '50px', justifyContent: 'center' }}>
<TextSearch.SearchBar
searchText={searchText}
onSearchSubmit={setSearchText}
onSearchSubmit={(newSearchText) => {
setSearchText(newSearchText);
setPage(1);
}}
/>
{tabOption === tabOptions.Posts && renderPostSortOptions()}
{tabOption === tabOptions.Users && renderUserSortOptions()}
Expand Down

0 comments on commit 96f5a90

Please sign in to comment.