intercom-react-native
intercom-react-native copied to clipboard
[iOS] fix: prevent setDeviceToken to reject after resolving
Hello!
Debugging why setDeviceToken is rejecting was a bit painful as the error ended up hidden by a Tried to resolve a promise that has already been rejected error.
I was a bit surprised about that, I would have expected failure to be async isn't it ?
I made those changes as an attempt to prevent both resolving and rejecting, but if failure is sync maybe just exiting in there would be enough?
Anyway, I guess adding a success callback to the iOS SDK setDeviceToken and resolving in there would be cleaner.
Thanks!
We are seeing this error constantly, any chance this gets merged?
+1 for this
+1, also seeing this
seems no one is interested in this PR... so i just managed to create a patch-package for it. https://gist.github.com/yjb94/d352e167ddb74217e05ac94e2423a499
@uddish would you mind taking a look at this ? I've been using a patch similar to this one for almost a year now, it would be nice to get this fixed 🙏
Came up with a quite similar patch for the issue. I believe it's well understood, and even though the error won't crash your app this PR would address a major annoyance.
@stigi we are addressing this issue directly within the dependant iOS SDK. We will be exposing a new method which provides an explicit success callback. This will allow us to properly resolve the promise only when the operation has really succeeded, and to handle the errors in a clear deterministic way.
Fixed in https://github.com/intercom/intercom-react-native/pull/327/files released in https://github.com/intercom/intercom-react-native/releases/tag/9.0.4