From c6158fe7e47437d011fdfe09e5b74ec0c68ead39 Mon Sep 17 00:00:00 2001 From: Oliver Lewandowski <109145288+olewandowski1@users.noreply.github.com> Date: Thu, 27 Jun 2024 12:59:16 +0200 Subject: [PATCH] hotfix: unlock receive (#144) --- src/openlmis-local-storage/local-storage.factory.js | 2 +- .../orderable-fulfills.service.js | 3 ++- src/referencedata-program/program.service.js | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/openlmis-local-storage/local-storage.factory.js b/src/openlmis-local-storage/local-storage.factory.js index 085b653..8541f7c 100644 --- a/src/openlmis-local-storage/local-storage.factory.js +++ b/src/openlmis-local-storage/local-storage.factory.js @@ -108,7 +108,7 @@ if (Array.isArray(collectionToStore) && collectionToStore.length > 0) { executeWithStorageUpdate(function() { items = collectionToStore.map(function(item) { - if (item.id) { + if (item && item.id) { removeItemBy('id', item.id); } return typeof item === 'object' ? JSON.parse(JSON.stringify(item)) : item; diff --git a/src/referencedata-orderable-fulfills/orderable-fulfills.service.js b/src/referencedata-orderable-fulfills/orderable-fulfills.service.js index 1ad8876..23be650 100644 --- a/src/referencedata-orderable-fulfills/orderable-fulfills.service.js +++ b/src/referencedata-orderable-fulfills/orderable-fulfills.service.js @@ -73,7 +73,8 @@ return orderableFulfillJson; } - }); + }) + .filter(Boolean); orderableFulfillsOffline.putAll(orderableFulfillsToStore); diff --git a/src/referencedata-program/program.service.js b/src/referencedata-program/program.service.js index 09d313f..d653f01 100644 --- a/src/referencedata-program/program.service.js +++ b/src/referencedata-program/program.service.js @@ -179,7 +179,8 @@ var programsToStore = programs.map(function(program) { program.userIdOffline = userId; return program; - }); + }) + .filter(Boolean); userProgramsCache.putAll(programsToStore);