re-base icon indicating copy to clipboard operation
re-base copied to clipboard

removeBinding async?

Open henkiejan opened this issue 6 years ago • 1 comments

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 avatar Mar 08 '18 15:03 henkiejan

@henkiejan removeBinding should be synchronous. Will see if I can reproduce because that looks right to me. Thanks for reporting.

qwales1 avatar Mar 08 '18 23:03 qwales1