OneSignal / onesignal-vue3

Vue 3 OneSignal Plugin: Make it easy to integrate OneSignal with your Vue App!
Other
18 stars 5 forks source link

[Bug]: Trying to logout gives error #43

Closed vamsi-kleargroup closed 1 month ago

vamsi-kleargroup commented 2 months ago

What happened?

As the user logs in to our web app, we are calling $oneSignal.login(userId). After that we set up a few subscriptions to email and sms channels if the user toggles in our settings section.

When the user;ogs out we call $oneSignal.logout();. This call is giving the following error image (2)

We are using the following package version: "@onesignal/onesignal-vue3": "^2.0.1"

What browsers are you seeing the problem on?

Chrome (Chromium)

What operating system are you running?

Windows 10

Steps to reproduce?

1. Login using `$oneSignal.login(userId)`
2. Set email subscription using `$oneSignal.User.addEmail(email);`
3. logout using `$oneSignal.logout();`

What did you expect to happen?

The logout should work

Relevant log output

Uncaught (in promise) TypeError: Cannot read OSModelStore.js:32 properties of undefined (reading 'modelId')
at Ji.subscribeUpdateListener (OSModelStore.js:32:41)
at Ji.add (OSModelStore.js:16:14)
at en.add (CoreModuleDirector.js:106:32)
at tn.<anonymous> (LoginManager.js:113:9) at Generator.next (<anonymous>)
at r (tslib.es6.js:118:58)
jkasten2 commented 1 month ago

Thanks for reporting, we are able to reproduce this issue when OneSignal.logout() is called. It happens if a push subscription has not been created yet. We will look making a fix for this scenario.

jkasten2 commented 1 month ago

This has been fixed in this release: https://github.com/OneSignal/OneSignal-Website-SDK/releases/tag/160203

This update is automatic, the JS library this depends on always points the latest production WebSDK on cdn.onesignal.com.