From 9dafb99715a495d7819249596105b52b22bdbbc7 Mon Sep 17 00:00:00 2001 From: Ezerous Date: Wed, 9 Dec 2020 13:17:23 +0200 Subject: [PATCH] Close eventChannel when removing a db --- src/orbit/orbitSaga.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/orbit/orbitSaga.js b/src/orbit/orbitSaga.js index fb4820d..c92c2c4 100644 --- a/src/orbit/orbitSaga.js +++ b/src/orbit/orbitSaga.js @@ -133,6 +133,10 @@ function * removeDatabase({dbInfo}) { databases.delete(address); if(store){ + const { eventChannel } = store; + if(eventChannel) + eventChannel.close(); + yield call([store, store.close]); yield put({ type: ORBIT_DB_REMOVED, address }); return; @@ -183,6 +187,8 @@ function createOrbitDatabaseChannel (database){ function * callListenForOrbitDatabaseEvent ({ database }) { const orbitDatabaseChannel = yield call(createOrbitDatabaseChannel, database); + database.eventChannel = orbitDatabaseChannel; + yield put({type: ORBIT_DB_LISTEN, id: database.id}); try {