@droppii-org/chat-sdk 0.8.4 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -72,7 +72,7 @@ const LinkCollection = ({ onClose }) => {
|
|
|
72
72
|
}) })] }, date));
|
|
73
73
|
}, []);
|
|
74
74
|
if (dataFlatten.length === 0 && !isLoading)
|
|
75
|
-
return _jsx(Empty, { description: t("
|
|
75
|
+
return _jsx(Empty, { description: t("no_thread_links") });
|
|
76
76
|
if (isLoading)
|
|
77
77
|
return (_jsx("div", { className: "flex items-center justify-center", children: _jsx(Spin, {}) }));
|
|
78
78
|
return (_jsx("div", { id: "scrollableFileDiv", "data-cp-name": "LinkCollection", className: "h-full overflow-auto", children: _jsx(InfiniteScroll, { dataLength: Object.keys(groupedData).length, next: fetchNextPage, hasMore: hasNextPage, loader: _jsx("div", { className: "flex items-center justify-center py-2", children: _jsx(Spin, {}) }), scrollableTarget: "scrollableFileDiv", children: Object.entries(groupedData).map(([date, items]) => renderItem(date, items)) }) }));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSyncGroupStateAfterJoin.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useSyncGroupStateAfterJoin.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSyncGroupStateAfterJoin.d.ts","sourceRoot":"","sources":["../../../src/hooks/session/useSyncGroupStateAfterJoin.ts"],"names":[],"mappings":"AAeA,UAAU,gCAAgC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,0BAA0B,GAAI,cAExC,gCAAgC;;;CA+BlC,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
4
|
+
import { QUERY_KEYS } from "../../services/query";
|
|
3
5
|
import useConversationStore from "../../store/conversation";
|
|
4
6
|
import { useIsJoinedGroup } from "./useIsJoinedGroup";
|
|
5
7
|
const JOIN_GROUP_SYNC_DELAY = 500;
|
|
@@ -8,14 +10,25 @@ const waitForJoinGroupSync = () => new Promise((resolve) => {
|
|
|
8
10
|
});
|
|
9
11
|
export const useSyncGroupStateAfterJoin = ({ groupId, }) => {
|
|
10
12
|
const getCurrentGroupInfoByReq = useConversationStore((state) => state.getCurrentGroupInfoByReq);
|
|
13
|
+
const queryClient = useQueryClient();
|
|
11
14
|
const { isJoined, refetch: refetchIsJoined } = useIsJoinedGroup(groupId);
|
|
12
15
|
const syncGroupStateAfterJoin = useCallback(async () => {
|
|
13
16
|
await waitForJoinGroupSync();
|
|
14
|
-
await refetchIsJoined();
|
|
17
|
+
const { data: joinedLocally } = await refetchIsJoined();
|
|
15
18
|
if (!groupId)
|
|
16
19
|
return;
|
|
20
|
+
// Only called once the join REST call succeeded. Re-joining a group that
|
|
21
|
+
// is still cached locally (the agent left earlier) syncs as an update, so
|
|
22
|
+
// no OnJoinedGroupAdded fires and the local member lookup can stay empty
|
|
23
|
+
// for seconds — nothing would re-check, leaving the Join button up until
|
|
24
|
+
// F5. The server already confirmed membership, so trust it.
|
|
25
|
+
if (!joinedLocally) {
|
|
26
|
+
const queryKey = [QUERY_KEYS.IS_JOINED_GROUP, groupId];
|
|
27
|
+
await queryClient.cancelQueries({ queryKey });
|
|
28
|
+
queryClient.setQueryData(queryKey, true);
|
|
29
|
+
}
|
|
17
30
|
await getCurrentGroupInfoByReq(groupId);
|
|
18
|
-
}, [getCurrentGroupInfoByReq, groupId, refetchIsJoined]);
|
|
31
|
+
}, [getCurrentGroupInfoByReq, groupId, queryClient, refetchIsJoined]);
|
|
19
32
|
return {
|
|
20
33
|
isJoined,
|
|
21
34
|
syncGroupStateAfterJoin,
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"media_resources_title": "Tập tin phương tiện",
|
|
10
10
|
"no_resource_files": "Không tìm thấy tập tin nào",
|
|
11
11
|
"no_resource_links": "Không tìm thấy liên kết nào",
|
|
12
|
+
"no_thread_links": "Không có liên kết nào",
|
|
12
13
|
"previous_video": "Video trước",
|
|
13
14
|
"next_video": "Video tiếp theo",
|
|
14
15
|
"resource_load_error": "Không thể tải dữ liệu. Vui lòng thử lại.",
|