react-native-firebase icon indicating copy to clipboard operation
react-native-firebase copied to clipboard

onAuthStateChanged triggered twice upon Facebook login after update from 3.2.2 to latest

Open DavideValdo opened this issue 8 years ago • 5 comments

Issue

This is a problem for me because I'm creating Firestore onSnapshot() listeners after I know the uid.

At first I was trying to store the callbacks to unsubscribe and retrieve them through getState() in the thunk directly. Couldn't work because the two onAuthStateChanged events fire in a short time delta for the Store to be synced up.

Currently solving with a dangerous variable like this:

let GLOBAL_currentUID = null;
/* 
   This is called by onAuthStateChanged() when I already know the uid is a seller  
/*
export function startSellershipListeners (uid) {
    console.log("Registering sellership listeners for", uid)

    return (dispatch) => {
        if (!GLOBAL_currentUID)
            GLOBAL_currentUID = uid
        else if (GLOBAL_currentUID == uid) {
            return false
        }

        dispatch(registerMembershipInfoListener(uid))
        dispatch(fetchSellerMeta(uid))
        dispatch(fetchOwnWishes(uid))
        dispatch(fetchOwnProducts(uid))
        dispatch(fetchOwnNews(uid))
    }
}

Project Files

  • iOS: Podfile

iOS

ios/Podfile:

  • [ ] I'm not using Pods
  • [x] I'm using Pods and my Podfile looks like: (All Firebase pods to ~> 5.9.0)

Environment

  • react-native-fbsdk version: ^0.8.0
  • Platform that you're experiencing the issue on:
    • [ ] iOS
    • [ ] Android
    • [] iOS but have not tested behavior on Android
    • [ ] Android but have not tested behavior on iOS
    • [X] Both
  • If known, the version of the platform are you experiencing the issue on:
    • iOS 12/Android 28
  • Operating System:
    • [X] MacOS, version: 10.13.6
    • [ ] Windows, version: N/A
    • [ ] Other, please specify: N/A
  • Build Tools:
    • Xcode 10 e.g. Xcode 10, Android Studio 3.2
  • React Native version:
    • 0.57.1
  • React Native Firebase library version:
    • 5.1.1
  • Firebase module(s) you're using that has the issue:
    • [X] Authentication
    • [ ] Analytics
    • [ ] Cloud Firestore
    • [ ] Cloud Messaging (FCM)
    • [ ] Crashlytics
    • [ ] Dynamic Links
    • [ ] Functions Callable
    • [ ] Invites
    • [ ] Instance ID
    • [ ] Notifications
    • [ ] Performance Monitoring
    • [ ] Realtime Database
    • [ ] Remote Config
    • [ ] Storage
  • Are you using TypeScript?
    • [X] No
    • [ ] Yes, version: N/A
  • Are you using Expo, e.g. ExpoKit?
    • [X] No
    • [ ] Yes, I've not ejected
    • [ ] Yes, but I have ejected to ExpoKit
    • [ ] Yes, but I have ejected to vanilla React Native
    • Expo version: N/A

DavideValdo avatar Nov 30 '18 19:11 DavideValdo

Hello 👋, this issue has been automatically marked as stale because it has not had activity for quite some time. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jan 04 '19 06:01 stale[bot]

Closing this issue after a prolonged period of inactivity. If this is still present in the latest release, please feel free to create a new issue with up-to-date information.

stale[bot] avatar Jan 18 '19 10:01 stale[bot]

I'm having this issue as well. Did you find an answer?

eemebarbe avatar Feb 12 '19 09:02 eemebarbe

This issue still happening. Nothing yet?

andresain123 avatar Feb 14 '19 10:02 andresain123

Still checking the uid with a global variable

DavideValdo avatar Feb 25 '19 19:02 DavideValdo