mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: do not fetch empty ID list on transaction
This commit is contained in:
@@ -27,10 +27,13 @@ export const addTransactionCapability = (state: SignalKeyStore, logger: Logger):
|
|||||||
|
|
||||||
const dict = transactionCache[type]
|
const dict = transactionCache[type]
|
||||||
const idsRequiringFetch = ids.filter(item => !dict?.[item])
|
const idsRequiringFetch = ids.filter(item => !dict?.[item])
|
||||||
const result = await state.get(type, idsRequiringFetch)
|
// only fetch if there are any items to fetch
|
||||||
|
if(idsRequiringFetch.length) {
|
||||||
|
const result = await state.get(type, idsRequiringFetch)
|
||||||
|
|
||||||
transactionCache[type] = transactionCache[type] || { }
|
transactionCache[type] = transactionCache[type] || { }
|
||||||
Object.assign(transactionCache[type], result)
|
Object.assign(transactionCache[type], result)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|||||||
Reference in New Issue
Block a user