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

Uncaught rejected promise when attempting to fetch flags while offline #249

Open
frankieyan opened this issue Sep 13, 2024 · 1 comment · May be fixed by #256
Open

Uncaught rejected promise when attempting to fetch flags while offline #249

frankieyan opened this issue Sep 13, 2024 · 1 comment · May be fixed by #256

Comments

@frankieyan
Copy link

Hi there 👋 I'm seeing an uncaught rejection when calling Flagsmith.init while offline.

image
image

It seems to be coming from this call:

if (shouldFetchFlags) {
// We want to resolve init since we have cached flags
this.getFlags();

It doesn't cause any real issues as flags are still resolved correctly from local storage, and since the user is likely offline when this happens, it may not affect our telemetry. However, since it's not an error that can be caught in user land, perhaps it'd make more sense to handle the rejection and only reject from init() if the cache fails.

Please let me know if you need more details, thank you!

@matthewelwell
Copy link
Contributor

Hi @frankieyan, thanks for raising this. I think your suggestion here makes sense

handle the rejection and only reject from init() if the cache fails

Would you be willing to submit a PR for this?

@frankieyan frankieyan linked a pull request Oct 3, 2024 that will close this issue
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

Successfully merging a pull request may close this issue.

2 participants