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

[iOS] fix: prevent setDeviceToken to reject after resolving

Open jblarriviere opened this issue 10 months ago • 2 comments

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!

jblarriviere avatar Jan 21 '25 10:01 jblarriviere

We are seeing this error constantly, any chance this gets merged?

saaaab1213 avatar Feb 19 '25 12:02 saaaab1213

+1 for this

yjb94 avatar Mar 25 '25 05:03 yjb94

+1, also seeing this

grydstedt avatar Apr 10 '25 08:04 grydstedt

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

yjb94 avatar May 14 '25 03:05 yjb94

@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 🙏

ACHP avatar May 28 '25 07:05 ACHP

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 avatar Sep 08 '25 16:09 stigi

@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.

jasonpraful avatar Sep 08 '25 16:09 jasonpraful

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

jasonpraful avatar Sep 15 '25 12:09 jasonpraful