Skip to content

Commit 7f06fd5

Browse files
committed
refactor: rename pagination indicator in SearchController from hasMore to hasNext
1 parent 0f8016c commit 7f06fd5

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

src/experimental/Search/SearchResults/SearchSourceResultListFooter.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { SearchSourceState } from 'stream-chat';
99
import type { DefaultStreamChatGenerics } from '../../../types';
1010

1111
const searchSourceStateSelector = (value: SearchSourceState) => ({
12-
hasMore: value.hasMore,
12+
hasNext: value.hasNext,
1313
isLoading: value.isLoading,
1414
});
1515

@@ -21,13 +21,13 @@ export const SearchSourceResultListFooter = <
2121
SearchSourceResultsLoadingIndicator = DefaultSearchSourceResultsLoadingIndicator,
2222
} = useComponentContext<StreamChatGenerics>();
2323
const { searchSource } = useSearchSourceResultsContext();
24-
const { hasMore, isLoading } = useStateStore(searchSource.state, searchSourceStateSelector);
24+
const { hasNext, isLoading } = useStateStore(searchSource.state, searchSourceStateSelector);
2525

2626
return (
2727
<div className='str-chat__search-source-result-list__footer' data-testid='search-footer'>
2828
{isLoading ? (
2929
<SearchSourceResultsLoadingIndicator />
30-
) : !hasMore ? (
30+
) : !hasNext ? (
3131
<div className='str-chat__search-source-results---empty'>
3232
{t<string>('All results loaded')}
3333
</div>

src/experimental/Search/SearchResults/SearchSourceResults.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import type { SearchSource, SearchSourceState } from 'stream-chat';
1111
import type { DefaultStreamChatGenerics } from '../../../types';
1212

1313
const searchSourceStateSelector = (nextValue: SearchSourceState) => ({
14-
hasMore: nextValue.hasMore,
1514
isLoading: nextValue.isLoading,
1615
items: nextValue.items,
1716
});

src/experimental/Search/__tests__/SearchSourceResultListFooter.test.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,14 @@ describe('SearchSourceResultListFooter', () => {
3838
});
3939

4040
useStateStore.mockReturnValue({
41-
hasMore: true,
41+
hasNext: true,
4242
isLoading: false,
4343
});
4444
});
4545

4646
it('renders loading indicator when isLoading is true', () => {
4747
useStateStore.mockReturnValue({
48-
hasMore: true,
48+
hasNext: true,
4949
isLoading: true,
5050
});
5151

@@ -55,9 +55,9 @@ describe('SearchSourceResultListFooter', () => {
5555
expect(screen.queryByText('All results loaded')).not.toBeInTheDocument();
5656
});
5757

58-
it('renders "All results loaded" message when hasMore is false', () => {
58+
it('renders "All results loaded" message when hasNext is false', () => {
5959
useStateStore.mockReturnValue({
60-
hasMore: false,
60+
hasNext: false,
6161
isLoading: false,
6262
});
6363

@@ -69,7 +69,7 @@ describe('SearchSourceResultListFooter', () => {
6969

7070
it('renders only the footer wrapper when not loading and has more results', () => {
7171
useStateStore.mockReturnValue({
72-
hasMore: true,
72+
hasNext: true,
7373
isLoading: false,
7474
});
7575

@@ -90,7 +90,7 @@ describe('SearchSourceResultListFooter', () => {
9090
});
9191

9292
useStateStore.mockReturnValue({
93-
hasMore: true,
93+
hasNext: true,
9494
isLoading: true,
9595
});
9696

@@ -105,7 +105,7 @@ describe('SearchSourceResultListFooter', () => {
105105
useTranslationContext.mockReturnValue({ t: mockTranslate });
106106

107107
useStateStore.mockReturnValue({
108-
hasMore: false,
108+
hasNext: false,
109109
isLoading: false,
110110
});
111111

@@ -119,15 +119,15 @@ describe('SearchSourceResultListFooter', () => {
119119
const { rerender } = render(<SearchSourceResultListFooter />);
120120

121121
useStateStore.mockReturnValue({
122-
hasMore: false,
122+
hasNext: false,
123123
isLoading: false,
124124
});
125125

126126
rerender(<SearchSourceResultListFooter />);
127127
expect(screen.getByText('All results loaded')).toBeInTheDocument();
128128

129129
useStateStore.mockReturnValue({
130-
hasMore: true,
130+
hasNext: true,
131131
isLoading: true,
132132
});
133133

0 commit comments

Comments
 (0)