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

Fix multiple network setups for React Native SDKs #687

Conversation

romin-halltari
Copy link
Contributor

@romin-halltari romin-halltari commented Dec 15, 2023

📦 Pull Request

Previously, we were using await this.checkIsReadyForRequest before sending a request. Problem is, after first render, this promise will return immediately, even when the relayer is re-rendered. That is because we don't re-construct the controller each time a render happens (that's a no-op).

This PR introduces the isReadyForRequest boolean which we can reset to false when the relayer is unmounted. That allows us to wait again until the WebView is ready for requests on re-mount.

We still keep checkIsReadyForRequest because it is used for faster initial requests in browser environments.

Before:
https://github.com/magiclabs/magic-js/assets/150072475/7c184022-7938-4a8b-a9ee-c6ac50ee281c

After:
https://github.com/magiclabs/magic-js/assets/150072475/003dcb69-9b1c-41c6-a5bd-1052a9204aca

[Provide a general summary of the pull request here.]

✅ Fixed Issues

🚨 Test instructions

[Describe any additional context required to test the PR/feature/bug fix.]

⚠️ Don't forget to add a semver label!

Please only add one label:

  • patch: Bug Fix?
  • minor: New Feature?
  • major: Breaking Change?
  • skip-release: It's unnecessary to publish this change.
📦 Published PR as canary version: Canary Versions

✨ Test out this PR locally via:

npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-ext/[email protected]
npm install @magic-sdk/[email protected]
npm install @magic-sdk/[email protected]
npm install @magic-sdk/[email protected]
npm install @magic-sdk/[email protected]
npm install @magic-sdk/[email protected]
npm install [email protected]
# or 
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-ext/[email protected]
yarn add @magic-sdk/[email protected]
yarn add @magic-sdk/[email protected]
yarn add @magic-sdk/[email protected]
yarn add @magic-sdk/[email protected]
yarn add @magic-sdk/[email protected]
yarn add [email protected]

@romin-halltari romin-halltari added the patch Increment the patch version when merged label Dec 15, 2023
@romin-halltari romin-halltari self-assigned this Dec 15, 2023
Copy link

Ethella
Ethella previously approved these changes Dec 15, 2023
@romin-halltari romin-halltari added this pull request to the merge queue Dec 15, 2023
Merged via the queue into master with commit 9a60ebe Dec 15, 2023
4 checks passed
@romin-halltari romin-halltari deleted the rominhalltari-sc-91530-investigate-and-provide-solution-for-issue branch December 15, 2023 23:11
@Ariflo Ariflo added the released This issue/pull request has been released. label Dec 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch Increment the patch version when merged released This issue/pull request has been released.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants