Skip to content

Commit 7c119b8

Browse files
fix: unable to fetch due to incorrect initialData
1 parent 9b80c01 commit 7c119b8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

apps/meteor/client/components/Omnichannel/hooks/useTagsList.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type TagListItem = {
1818
const DEFAULT_QUERY_LIMIT = 25;
1919

2020
export const useTagsList = (options: TagsListOptions) => {
21-
const { viewAll, department, filter, limit } = options;
21+
const { viewAll, department, filter, limit = DEFAULT_QUERY_LIMIT } = options;
2222

2323
const getTags = useEndpoint('GET', '/v1/livechat/tags');
2424

@@ -34,7 +34,7 @@ export const useTagsList = (options: TagsListOptions) => {
3434
const { tags, ...data } = await getTags({
3535
text: filter,
3636
offset,
37-
count: limit ?? DEFAULT_QUERY_LIMIT,
37+
count: limit,
3838
...(viewAll && { viewAll: 'true' }),
3939
...(department && { department }),
4040
sort: JSON.stringify({ name: 1 }),
@@ -52,7 +52,7 @@ export const useTagsList = (options: TagsListOptions) => {
5252
return offset < lastPage.total ? offset : undefined;
5353
},
5454
initialData: () => ({
55-
pages: [{ tags: [], total: 0, offset: 0, count: limit ?? DEFAULT_QUERY_LIMIT }],
55+
pages: [{ tags: [], offset: 0, count: 0, total: Infinity }],
5656
pageParams: [0],
5757
}),
5858
});

0 commit comments

Comments
 (0)