fix sending sync rows via WebSocket after transaction is committed

This commit is contained in:
zadam
2020-06-21 13:44:47 +02:00
parent c34a9b96e4
commit f117ae4915
3 changed files with 16 additions and 31 deletions

View File

@@ -33,8 +33,12 @@ function isEntityEventsDisabled() {
return !!namespace.get('disableEntityEvents');
}
function getSyncRows() {
return namespace.get('syncRows') || [];
function getAndClearSyncRows() {
const syncRows = namespace.get('syncRows') || [];
namespace.set('syncRows', []);
return syncRows;
}
function addSyncRow(syncRow) {
@@ -68,7 +72,7 @@ module.exports = {
disableEntityEvents,
isEntityEventsDisabled,
reset,
getSyncRows,
getAndClearSyncRows,
addSyncRow,
getEntityFromCache,
setEntityToCache