react-native-branch-deep-linking-attribution icon indicating copy to clipboard operation
react-native-branch-deep-linking-attribution copied to clipboard

How are subscribe errors supposed to be handled?

Open evelant opened this issue 4 years ago • 0 comments

The documentation doesn't say anything beyond "if there is no error then params will not be null". What about when there is an error? How should it be handled?

If I test with my app offline branch.subscribe gives an error in the callback Branch API Error: poor network connectivity. Please try again later. but that appears impossible. If I reconnect with the app open the callback is not called again, indicating that Branch does not retry on its own. If I call subscribe again the callback never gets called. If I call the unsubscribe function first then call subscribe again the callback never gets called.

It seems that once an error has happened in branch.subscribe that the branch SDK becomes non-functional until the next hard app restart. That's obviously undesirable since we need to get deferred deep link params on the user's first session.

edit: After further testing I've found the following behavior

  • It appears that the subscribe callback will get called again but only after the app has changed state from background to foreground again. It seems if an error occurs that the SDK no longer works for the rest of the session.
  • In addition the "unsubscribe" callback does not work. If you call the unsubscribe callback then subscribe again nothing happens until the next app state change to foreground at which time the both the old and the new subscribe callback will run. This is a bug and a memory leak.

evelant avatar Jun 23 '21 15:06 evelant