re-base
re-base copied to clipboard
removeBinding async?
Hello,
I was wondering if removeBinding(ref) is perhaps async, or am I missing something else?
In this code onFailure is called after calling logout():
listenToAuth = () => {
this.listenerAuth = auth.onAuthStateChanged((user) => {
if (user) {
.......
if (this.listenerUser) {
base.removeBinding(this.listenerUser);
}
this.listenerUser = base.bindToState('user/' + user.uid, {
context: this,
state: 'user',
asArray: false,
then: () => {.......},
onFailure: (err) => {.......}
})
}
})
});
logout = () => {
if (this.listenerUser) {
base.removeBinding(this.listenerUser);
}
auth.signOut();
};
The signout of Firebase is called after removing all listeners and the user should be null, but the onFailure is still being called.
@henkiejan removeBinding should be synchronous. Will see if I can reproduce because that looks right to me. Thanks for reporting.