-
Notifications
You must be signed in to change notification settings - Fork 85
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
Purchases.syncPurchases error: "There is no singleton instance. Make sure you configure Purchases before trying to get the default instance." #739
Comments
👀 We've just linked this issue to our internal tracker and notified the team. Thank you for reporting, we're checking this out! |
Hello, |
Hi @skam22, I've been looking into this and haven't been able to find what could possibly be wrong here. Something did catch my attention though:
Is it possible that the error is being thrown from a different call to |
Hi, Could this be due to React rendering components twice in Development mode? I believe i noticed that Looking at the code, it seems that |
@Cnordbo that's definitely interesting. I think this could happen if the components are being rendered twice. I don't see code in the Android SDK that will trigger an exception if @skam22 are you setting strict mode like indicated in React Docs - Keeping Components Pure? Do you think this could be causing the issues you're seeing? |
@vegaro - I am not sure about this, but let me just assume something as well here. You dont really need to run in strict mode to trigger this, i think, as i am not running StrictMode myself and got this. I would assume (but could be wrong here) that the instance generated in iOS (and probably Android as well) is the same during re-renders. So while your developing, you would most-likely cause a re-render each time of the affected components. Meaning that if you change something that, depending on your implementation / .Configure point, requires a re-render of your .Configure / Complete re-render, meaning this would get called twice anyway, while still keeping the runtime-instance of Purchases alive. As a change, would it be possible to allow the .Configure method be called multiple times without throwing an exception, if it really doesnt matter? |
Describe the bug
Purchases.syncPurchases() Error:
index.js:
App.tsx
interestingly syncPurchases resolves the promise successfully so the error is not caught by the try/catch block. an unhandled promise warning is thrown AFTER syncPurchases() has supposedly already completed.
The text was updated successfully, but these errors were encountered: