fix: don't call event handler for new messages directly to puppeteer

This was creating performance issues, specially on startup when the initial set of messages were being loaded for a client with many chats.
This commit is contained in:
Pedro Lopez
2020-03-13 00:09:43 -04:00
parent b41414cfbf
commit 8bdecadba4

View File

@@ -277,7 +277,7 @@ class Client extends EventEmitter {
});
await page.evaluate(() => {
window.Store.Msg.on('add', window.onAddMessageEvent);
window.Store.Msg.on('add', (msg) => { if(msg.isNewMsg) window.onAddMessageEvent(msg);});
window.Store.Msg.on('change', window.onChangeMessageEvent);
window.Store.Msg.on('change:type', window.onChangeMessageTypeEvent);
window.Store.Msg.on('change:ack', window.onMessageAckEvent);