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 {