Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeBinding async? #250

Open
henkiejan opened this issue Mar 8, 2018 · 1 comment
Open

removeBinding async? #250

henkiejan opened this issue Mar 8, 2018 · 1 comment

Comments

@henkiejan
Copy link

henkiejan commented Mar 8, 2018

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.

@qwales1
Copy link
Collaborator

qwales1 commented Mar 8, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants