我有这些麻烦,但是我每次都在频道和失败动作上退订。是什么原因?我正在使用React Native Firebase和RNFirestore
function firebaseChannel(userId) {
const ref = database
.collection("chat_rooms")
.where("metadata.members." + userId, ">", 0)
.orderBy("metadata.members." + userId, "desc")
const channel = eventChannel(emit => {
const unsubscribe = ref.onSnapshot(emit)
// Returns unsubscribe function
return unsubscribe
})
return channel
}
export function* sync() {
const userId = getUserId()
const channel = yield call(firebaseChannel, userId)
try {
while (true) {
const data = yield take(channel);
yield fork(successActionCreator(data, userId));
}
} catch (err) {
// yield fork(failureActionCreator(err))
console.tron.log("Failure", err)
}
finally {
// if (yield cancelled()) {
// channel.close();
// }
}
}