diff --git a/client/src/components/chat-popup/chat-popup.component.jsx b/client/src/components/chat-popup/chat-popup.component.jsx
index 5ac4baec1..899fd3058 100644
--- a/client/src/components/chat-popup/chat-popup.component.jsx
+++ b/client/src/components/chat-popup/chat-popup.component.jsx
@@ -4,7 +4,7 @@ import {
ShrinkOutlined,
SyncOutlined,
} from "@ant-design/icons";
-import { useLazyQuery, useQuery, useSubscription } from "@apollo/client";
+import { useLazyQuery, useSubscription } from "@apollo/client";
import { Badge, Card, Col, Row, Space, Tag, Tooltip, Typography } from "antd";
import React, { useCallback, useEffect, useState } from "react";
import { useTranslation } from "react-i18next";
@@ -46,17 +46,9 @@ export function ChatPopupComponent({
UNREAD_CONVERSATION_COUNT_SUBSCRIPTION
);
- // const { data: unreadData, refetch: unreadRefetch } = useQuery(
- // UNREAD_CONVERSATION_COUNT,
- // {
- // fetchPolicy: "network-only",
- // nextFetchPolicy: "network-only",
- // }
- // );
-
const [
getConversations,
- { loading, data, called, fetchMore, subscribeToMore },
+ { loading, data, called, refetch, fetchMore, subscribeToMore },
] = useLazyQuery(CONVERSATION_LIST_QUERY, {
fetchPolicy: "cache-and-network",
nextFetchPolicy: "cache-first",
@@ -91,44 +83,6 @@ export function ChatPopupComponent({
});
}, [data, fetchMore]);
- const subscribeToMoreConversations = useCallback(
- () =>
- subscribeToMore({
- document: CONVERSATION_LIST_SUBSCRIPTION,
- variables: { offset: 0 },
- updateQuery: (prev, { subscriptionData }) => {
- console.log("Hello");
- if (
- !subscriptionData.data ||
- subscriptionData.data.conversations.length === 0
- )
- return prev;
-
- let conversations = prev.conversations;
- const newConversations = subscriptionData.data.conversations;
-
- for (const conversation of newConversations) {
- const index = conversations.findIndex(
- (prevConversation) => prevConversation.id === conversation.id
- );
-
- if (index !== -1) {
- conversations.splice(index, 1);
- conversations.unshift(conversation);
- continue;
- }
-
- conversation.unshift(conversation);
- }
-
- return Object.assign({}, prev, {
- conversations: conversations,
- });
- },
- }),
- [subscribeToMore]
- );
-
const unreadCount = unreadData?.messages_aggregate.aggregate.count || 0;
return (
@@ -144,10 +98,10 @@ export function ChatPopupComponent({
- {/* refetch()}
- /> */}
+ />
{pollInterval > 0 && (
{t("messaging.labels.nopush")}
)}