From 65dec986023b55f04896a9fb4ba48f4a11ea793e Mon Sep 17 00:00:00 2001 From: Aleksander Nicacio da Silva Date: Tue, 20 Jun 2023 14:04:00 -0300 Subject: [PATCH] fix: Canned responses filter not working (#29565) --- .changeset/twelve-mirrors-destroy.md | 5 +++++ .../cannedResponses/CannedResponsesRoute.tsx | 20 ++++++++++--------- 2 files changed, 16 insertions(+), 9 deletions(-) create mode 100644 .changeset/twelve-mirrors-destroy.md diff --git a/.changeset/twelve-mirrors-destroy.md b/.changeset/twelve-mirrors-destroy.md new file mode 100644 index 0000000000000..0a3af769a4760 --- /dev/null +++ b/.changeset/twelve-mirrors-destroy.md @@ -0,0 +1,5 @@ +--- +'@rocket.chat/meteor': patch +--- + +Fixed canned responses filter not updating the table as expected diff --git a/apps/meteor/ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx b/apps/meteor/ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx index 1db1ec43bcce2..a02f05d7059fd 100644 --- a/apps/meteor/ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx +++ b/apps/meteor/ee/client/omnichannel/cannedResponses/CannedResponsesRoute.tsx @@ -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'], () =>