Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't fetch HTML content when using inAppHandler callback #534

Open
kaushikwavhal opened this issue Mar 26, 2024 · 1 comment
Open

Can't fetch HTML content when using inAppHandler callback #534

kaushikwavhal opened this issue Mar 26, 2024 · 1 comment

Comments

@kaushikwavhal
Copy link

Hi Iterable team,

When trying to fetch HTML content using IterableSDK.inAppManager.getHtmlContentForMessage called from within IterableConfig's inAppHandler callback, i get an error message that says the message could not be found and apparently the messageId from this message cannot be found in any of the message fetched via getMessages() call as well.

Error: Could not find message with id:

Versions:
"@iterable/react-native-sdk": "^1.3.13",
"react-native": "0.72.10",

@anta-semenov
Copy link

Have the same issue. What worked for me is that I fetch html content in inAppHandler after a setTimeout with 0 interval.
Looks like some race condition

config.inAppHandler = (message: IterableInAppMessage) => {
    Iterable.inAppManager.getHtmlContentForMessage(message).catch(() => {
       // here will be error
    })
    setTimeout(() => Iterable.inAppManager.getHtmlContentForMessage(message).then(() => {
        // here won't be error
    }), 0)
    return IterableInAppShowResponse.skip
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants