React-redux-firebase: bug(logout) firebase.logout does not return correct promise

Created on 5 Jun 2017  路  2Comments  路  Source: prescottprue/react-redux-firebase

firebase.logout calls auth.signOut which returns a promise.

However firebase.logout is rather presumptuous in assuming that stuff just happens instantly and always working, returning a Promise.resolve, leaving some state in limbo, rather than waiting for state to be pristine and things to be entirely cleaned up under the hood.

Easy fix, something along the lines (but untested):

export const logout = (dispatch, firebase) => {
  return firebase.auth().signOut().
    then(() => {
      dispatch({ type: LOGOUT })
      firebase._.authUid = null
      unWatchUserProfile(firebase)
      return firebase
    })
}
bug in-pre-release

Most helpful comment

@Domiii Good catch, this will for sure make it into the next pre-release of 1.5.0. This seems to be around from quite a while ago.

All 2 comments

@Domiii Good catch, this will for sure make it into the next pre-release of 1.5.0. This seems to be around from quite a while ago.

v1.5.0-beta.2 was released with this fix. Thanks again!

Was this page helpful?
0 / 5 - 0 ratings