Skip to content

Commit

Permalink
fix: Canned responses filter not working (#29565)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandernsilva authored Jun 20, 2023
1 parent 8b2fed7 commit 65dec98
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-mirrors-destroy.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Fixed canned responses filter not updating the table as expected
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,17 @@ const CannedResponsesRoute: FC = () => {

const getCannedResponses = useEndpoint('GET', '/v1/canned-responses');

const { data } = useQuery(['canned-responses', '/v1/canned-responses', debouncedText], () =>
getCannedResponses({
text: debouncedText,
sort: JSON.stringify({ [debouncedSort[0]]: debouncedSort[1] === 'asc' ? 1 : -1 }),
...(sharing && { scope: sharing }),
...(createdBy && createdBy !== 'all' && { createdBy }),
...(debouncedParams.itemsPerPage && { count: debouncedParams.itemsPerPage }),
...(debouncedParams.current && { offset: debouncedParams.current }),
}),
const { data } = useQuery(
['canned-responses', '/v1/canned-responses', { debouncedText, debouncedSort, debouncedParams, sharing, createdBy }],
() =>
getCannedResponses({
text: debouncedText,
sort: JSON.stringify({ [debouncedSort[0]]: debouncedSort[1] === 'asc' ? 1 : -1 }),
...(sharing && { scope: sharing }),
...(createdBy && createdBy !== 'all' && { createdBy }),
...(debouncedParams.itemsPerPage && { count: debouncedParams.itemsPerPage }),
...(debouncedParams.current && { offset: debouncedParams.current }),
}),
);

const { data: totalData, isInitialLoading: totalDataLoading } = useQuery(['canned-responses', '/v1/canned-responses'], () =>
Expand Down

0 comments on commit 65dec98

Please sign in to comment.