OneSignal / react-native-onesignal

React Native Library for OneSignal Push Notifications Service
Other
1.57k stars 373 forks source link

[Bug]: setExternalUserId sets only one record when called twice in a row. #1515

Open mljlynch opened 1 year ago

mljlynch commented 1 year ago

What happened?

We set up SetExternalUid on the email call back. Now we are getting external uids attached to the email record, but not the push notification record. Is this expected behavior?

My expectation would be that if I call code as follows - then both the push notification player record and email notification player record would be tagged with the same external UID. It seems however that the setting it in the email handler unsets it in the push notification record.

Steps to reproduce?

OneSignal.setExternalUserId(uid);
      if (email) {
        OneSignal.setEmail(email, undefined, () => {
          // Note: we have to set the onesignal euid again in the callback so
          // the external user id is set correctly in the email record
          // see: https://documentation.onesignal.com/docs/email-sdk-methods#setemail-method
          OneSignal.setExternalUserId(uid);
        });
      }

What did you expect to happen?

I would expect both the email and push notification record to have the external UID associated.

However, when using the above code, only the EMAIL record now has the external UID

React Native OneSignal SDK version

4.4.1

Which platform(s) are affected?

Relevant log output

No response

Code of Conduct

emawby commented 1 year ago

@mljlynch Thank you for reporting we will investigate

mljlynch commented 1 year ago

It appears this was fixed in https://github.com/OneSignal/react-native-onesignal/releases/tag/4.0.3, but I am on 4.4.1