Skip to content

Commit bbf31eb

Browse files
committed
Fix feedback coderabbit
1 parent 242c25b commit bbf31eb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

frontend/src/components/search/SearchListResults.tsx

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { User } from "../../models/User";
33
import { Content } from "../../models/Content";
44
import { useSearchParams } from "react-router-dom";
55
import ContentSearchResult from "./ContentSearchResult";
6-
import UserSearchResults from "./UserSearchResult";
6+
import UserSearchResult from "./UserSearchResult";
77
import { SearchService } from "../../services/SearchService";
88

99
function SearchListResults({
@@ -94,7 +94,7 @@ function SearchListResults({
9494
setUserStartingPoint(uniqueUsers[uniqueUsers.length - 1]?.uid || null);
9595

9696
// Enable or disable the "Fetch more" button based on the number of users
97-
setUserDisabled(usersReturned.length + uniqueUsers.length < 5);
97+
setUserDisabled(!userSearchResults.nextStartingPoint);
9898
} else {
9999
setUserDisabled(true); // Disable the button if no unique users are found
100100
}
@@ -143,8 +143,8 @@ function SearchListResults({
143143
uniqueContents[uniqueContents.length - 1]?.uid || null
144144
);
145145

146-
// Enable or disable the "Fetch more" button based on the number of users
147-
setContentDisabled(contentReturned.length + uniqueContents.length < 5);
146+
// Enable or disable the "Fetch more" button based on the number of contents
147+
setContentDisabled(!searchContentResults.nextStartingPoint);
148148
} else {
149149
setContentDisabled(true); // Disable the button if no unique content are found
150150
}
@@ -163,10 +163,11 @@ function SearchListResults({
163163
) : (
164164
usersReturned.map((user: User, index) => (
165165
<div key={index} className='searchItem'>
166-
<UserSearchResults user={user} />
166+
<UserSearchResult user={user} />
167167
</div>
168168
))
169169
)}
170+
{fetching && <p>Loading...</p>}
170171
{!userDisabled && (
171172
<button className='fetchMoreButton' onClick={fetchUserData}>
172173
Fetch more users
@@ -183,7 +184,7 @@ function SearchListResults({
183184
</div>
184185
))
185186
)}
186-
187+
{fetching && <p>Loading...</p>}
187188
{!contentDisabled && (
188189
<button className='fetchMoreButton' onClick={fetchContentData}>
189190
Fetch more contents

0 commit comments

Comments
 (0)