Browse Source

Close eventChannel when removing a db

develop
Ezerous 4 years ago
parent
commit
9dafb99715
  1. 6
      src/orbit/orbitSaga.js

6
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 {

Loading…
Cancel
Save