mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
fix: return mutations on patch
This commit is contained in:
@@ -208,7 +208,7 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const decoded = await extractSyncdPatches(result) // extract from binary node
|
const decoded = await extractSyncdPatches(result) // extract from binary node
|
||||||
|
const totalMutations: ChatMutation[] = []
|
||||||
for(const key in decoded) {
|
for(const key in decoded) {
|
||||||
const name = key as WAPatchName
|
const name = key as WAPatchName
|
||||||
const { patches, snapshot } = decoded[name]
|
const { patches, snapshot } = decoded[name]
|
||||||
@@ -226,17 +226,23 @@ export const makeChatsSocket = (config: SocketConfig) => {
|
|||||||
|
|
||||||
logger.info(`synced ${name} to v${newState.version}`)
|
logger.info(`synced ${name} to v${newState.version}`)
|
||||||
processSyncActions(newMutations)
|
processSyncActions(newMutations)
|
||||||
|
|
||||||
|
totalMutations.push(...newMutations)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return totalMutations
|
||||||
}
|
}
|
||||||
|
|
||||||
const resyncAppState = async(collections: WAPatchName[], returnSnapshot: boolean = false) => {
|
const resyncAppState = async(collections: WAPatchName[], returnSnapshot: boolean = false) => {
|
||||||
|
let result: ChatMutation[]
|
||||||
try {
|
try {
|
||||||
await resyncAppStateInternal(collections, returnSnapshot)
|
result = await resyncAppStateInternal(collections, false, returnSnapshot)
|
||||||
} catch(error) {
|
} catch(error) {
|
||||||
logger.info({ collections, error: error.stack }, 'failed to sync state from version, trying from scratch')
|
logger.info({ collections, error: error.stack }, 'failed to sync state from version, trying from scratch')
|
||||||
await resyncAppStateInternal(collections, true, true)
|
result = await resyncAppStateInternal(collections, true, true)
|
||||||
}
|
}
|
||||||
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user