Skip to content

Commit

Permalink
fix: Reactions tooltip loader (#31703)
Browse files Browse the repository at this point in the history
  • Loading branch information
yash-rajpal committed Feb 9, 2024
1 parent 1e833d5 commit 0639794
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rich-dingos-mix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@rocket.chat/meteor': patch
---

Added reactions tooltip loader
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Skeleton } from '@rocket.chat/fuselage';
import { useTranslation } from '@rocket.chat/ui-contexts';
import type { TranslationKey } from '@rocket.chat/ui-contexts';
import { useQuery } from '@tanstack/react-query';
Expand Down Expand Up @@ -42,7 +43,7 @@ const ReactionTooltip = ({ emojiName, usernames, mine, messageId, showRealName,

const getMessage = useGetMessageByID();

const { data: users } = useQuery(
const { data: users, isLoading } = useQuery(
['chat.getMessage', 'reactions', messageId, usernames],
async () => {
// This happens if the only reaction is from the current user
Expand Down Expand Up @@ -73,6 +74,17 @@ const ReactionTooltip = ({ emojiName, usernames, mine, messageId, showRealName,
{ staleTime: 1000 * 60 * 5 },
);

if (isLoading) {
return (
<>
<Skeleton width='x200' variant='text' backgroundColor='black' />
<Skeleton width='x200' variant='text' backgroundColor='black' />
{usernames.length > 5 && <Skeleton width='x200' variant='text' backgroundColor='black' />}
{usernames.length > 8 && <Skeleton width='x200' variant='text' backgroundColor='black' />}
</>
);
}

return (
<MarkdownText
content={t(key, {
Expand Down

0 comments on commit 0639794

Please sign in to comment.