IO-2208 remove unused variables and imports
This commit is contained in:
@@ -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({
|
||||
<Tooltip title={t("messaging.labels.recentonly")}>
|
||||
<InfoCircleOutlined />
|
||||
</Tooltip>
|
||||
{/* <SyncOutlined
|
||||
<SyncOutlined
|
||||
style={{ cursor: "pointer" }}
|
||||
onClick={() => refetch()}
|
||||
/> */}
|
||||
/>
|
||||
{pollInterval > 0 && (
|
||||
<Tag color="yellow">{t("messaging.labels.nopush")}</Tag>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user