@arbidocs/react 0.5.78 → 0.5.80
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.
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -14589,7 +14589,7 @@ interface ChatSummary {
|
|
|
14589
14589
|
}
|
|
14590
14590
|
/**
|
|
14591
14591
|
* Decrypted titles and last-message previews for a list of chats. Only the newest message of
|
|
14592
|
-
* each chat is decrypted — a thread decrypts in full when it is opened.
|
|
14592
|
+
* each chat is decrypted — a thread decrypts in full when it is opened, and its copy is used.
|
|
14593
14593
|
*/
|
|
14594
14594
|
declare function useChatSummaries(chats: ChatResponse[]): Record<string, ChatSummary>;
|
|
14595
14595
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -14589,7 +14589,7 @@ interface ChatSummary {
|
|
|
14589
14589
|
}
|
|
14590
14590
|
/**
|
|
14591
14591
|
* Decrypted titles and last-message previews for a list of chats. Only the newest message of
|
|
14592
|
-
* each chat is decrypted — a thread decrypts in full when it is opened.
|
|
14592
|
+
* each chat is decrypted — a thread decrypts in full when it is opened, and its copy is used.
|
|
14593
14593
|
*/
|
|
14594
14594
|
declare function useChatSummaries(chats: ChatResponse[]): Record<string, ChatSummary>;
|
|
14595
14595
|
/**
|
package/dist/index.js
CHANGED
|
@@ -14306,6 +14306,7 @@ function useUnreadByPeer() {
|
|
|
14306
14306
|
}
|
|
14307
14307
|
function useChatSummaries(chats2) {
|
|
14308
14308
|
const arbi = useArbi();
|
|
14309
|
+
const queryClient = useQueryClient();
|
|
14309
14310
|
const [summaries, setSummaries] = useState({});
|
|
14310
14311
|
const runId = useRef(0);
|
|
14311
14312
|
const key = chats2.map(
|
|
@@ -14320,7 +14321,9 @@ function useChatSummaries(chats2) {
|
|
|
14320
14321
|
const title = await arbi.chats.title(chat).catch(() => null);
|
|
14321
14322
|
const last = chat.last_message?.deleted ? null : chat.last_message;
|
|
14322
14323
|
let preview = null;
|
|
14323
|
-
|
|
14324
|
+
const open = queryClient.getQueryData(arbiQueryKeys.chatThread(chat.external_id))?.messages.find((m) => m.external_id === last?.external_id);
|
|
14325
|
+
if (open) preview = chats.chatMessagePreview(open);
|
|
14326
|
+
else if (last) {
|
|
14324
14327
|
preview = await arbi.chats.decrypt(chat, last).then(chats.chatMessagePreview).catch(() => chats.ENCRYPTED_PREVIEW);
|
|
14325
14328
|
}
|
|
14326
14329
|
next[chat.external_id] = { title, preview };
|