You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, i am currenlty facing an issue where users of my app are logging in and out right after eachother. while logging out im removing some user specific collections, which leads to the replicationstate of collections beeing reset in the rxdb itself. so far so good.
but now it happen that users login right after again, and the old references to useRXCollections are now destroyed:true, as one can expect.
Im recreating the collections properly before the user can login again, but this is not picked up by rxdb-hooks anymore as if the collection has been found immidiatley there is no subscription to the "newCollection$" subject:
useEffect(() => {
if (!db) {
return;
}
const found = db[name];
if (found) {
setCollection(found); <------ here we wont subscribe
} else {
const sub = db.newCollections$.subscribe(col => {
if (col[name]) {
// We don't unsubscribe so that we get notified
// and update collection if it gets deleted/recreated
setCollection(col[name]);
}
});
return () => {
sub.unsubscribe();
};
}
}, [db, name]);
i am now wondering why this is the behaviour rxdb-hooks opt for, and if i get side effects im not aware of if i subscribe to the subject anyhow. Or ist this just a usecase that has not been tought of and therfore is not covered?
The text was updated successfully, but these errors were encountered:
Hello, i am currenlty facing an issue where users of my app are logging in and out right after eachother. while logging out im removing some user specific collections, which leads to the replicationstate of collections beeing reset in the rxdb itself. so far so good.
but now it happen that users login right after again, and the old references to useRXCollections are now destroyed:true, as one can expect.
Im recreating the collections properly before the user can login again, but this is not picked up by rxdb-hooks anymore as if the collection has been found immidiatley there is no subscription to the "newCollection$" subject:
i am now wondering why this is the behaviour rxdb-hooks opt for, and if i get side effects im not aware of if i subscribe to the subject anyhow. Or ist this just a usecase that has not been tought of and therfore is not covered?
The text was updated successfully, but these errors were encountered: