fix for non-sync WS messages

This commit is contained in:
azivner
2017-12-17 13:46:18 -05:00
parent ccc7775c7c
commit cf7ab2b8d6
3 changed files with 6 additions and 6 deletions

View File

@@ -19,14 +19,14 @@ const messaging = (function() {
function messageHandler(event) {
const message = JSON.parse(event.data);
if (message.data.length > 0) {
console.log(message);
}
if (message.type === 'sync') {
lastPingTs = new Date().getTime();
const syncData = message.data.filter(sync => sync.source_id !== glob.sourceId);
if (syncData.length > 0) {
console.log("Sync data: ", message);
}
if (syncData.some(sync => sync.entity_name === 'notes_tree')) {
console.log("Reloading tree because of background changes");