From ffaf97dda2676fd3c3ff894ce9b136ea9ed94744 Mon Sep 17 00:00:00 2001 From: Michael Taylor Date: Tue, 13 Sep 2022 16:08:21 -0400 Subject: [PATCH] fix: home org in persistance file --- src/datalayer/persistance.js | 2 +- src/datalayer/syncService.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/datalayer/persistance.js b/src/datalayer/persistance.js index 239570db..594f6d73 100644 --- a/src/datalayer/persistance.js +++ b/src/datalayer/persistance.js @@ -265,7 +265,7 @@ const subscribeToStoreOnDataLayer = async (storeId) => { const homeOrg = await Organization.getHomeOrg(); - if ([homeOrg.orgUid, homeOrg.registryId].includes(storeId)) { + if (homeOrg && [(homeOrg.orgUid, homeOrg.registryId)].includes(storeId)) { logger.info(`Cant subscribe to self: ${storeId}`); return { success: true }; } diff --git a/src/datalayer/syncService.js b/src/datalayer/syncService.js index 50864280..ecd01c6d 100644 --- a/src/datalayer/syncService.js +++ b/src/datalayer/syncService.js @@ -174,6 +174,7 @@ const dataLayerWasUpdated = async () => { const updatedHomeInfo = updateStoreInfo.find( (info) => info.storeId === homeOrg.registryId, ); + if (updatedHomeInfo.rootHash !== homeOrg.registryHash) { await Staging.destroy({ where: { isTransfer: true } }); }