fix(react): race condition between initialize and isAuthorized in RN#75
Merged
andrascodes merged 1 commit intoMay 13, 2026
Conversation
This was referenced Apr 1, 2026
8837a4c to
5f1e79a
Compare
6d3fa6a to
49a2c93
Compare
5f1e79a to
9134f2e
Compare
49a2c93 to
9631468
Compare
This was referenced Apr 1, 2026
9631468 to
5dfaff7
Compare
9134f2e to
19af0fe
Compare
5dfaff7 to
ed19d1b
Compare
19af0fe to
67fc62b
Compare
ed19d1b to
64aaa8d
Compare
67fc62b to
7e8b5c9
Compare
7e8b5c9 to
6d49f74
Compare
64aaa8d to
1be46e0
Compare
This was referenced Apr 29, 2026
e37a38e to
72d702a
Compare
1609ff9 to
21c5bb8
Compare
72d702a to
9fcc007
Compare
48228c1 to
bacc73c
Compare
9fcc007 to
6cbe1be
Compare
6cbe1be to
93c9219
Compare
3bdb8a3 to
66555a7
Compare
93c9219 to
0004ce4
Compare
66555a7 to
c6d9181
Compare
0004ce4 to
6f58d08
Compare
c6d9181 to
bdf379f
Compare
6f58d08 to
b93af0f
Compare
b93af0f to
accc419
Compare
bdf379f to
57273e4
Compare
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
57273e4 to
b980e22
Compare
accc419 to
47943b2
Compare
b980e22 to
3752741
Compare
47943b2 to
23d330a
Compare
23d330a to
e185758
Compare
brtkx
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is part of a stack created with Aviator.
mainCloses FS-1930
On mobile when passing in a
SecureStoreStamperto the SDK I noticed that the session refresh wasn't working properly. The session refresh itself succeeded (soinitialize()ran and completed) but theconnect()wasn't being called inside wagmi.Here's the lifecycle of the connector methods in
wagmi:In Wagmi:
setup()is called in createConfig, it's not awaited, you can see it here - so this just kicks off our session refresh andinitialize()In
reconnect()(when the user refreshes the app): (here)getProvider()is called first, awaited,if !providerthen skips - on mobile we have the provider here already so this is truthy and the execution continues toisAuthorized(): this gets called and awaited, here theeoaAccountthat we return is stillnullwhen this method is called, becauseinitalize()takes too long likely because of thesecureStoreStamperoperations. So when this happens thereconnect()doesn't continue. It just skips our connector.The fix I opted for was awaiting
initialize()ingetProvider()so even at that point we for sure have theProviderand initialized the session.An additional fix I opted for was awaiting the hydration of the Zustand store as well. This is best done because on React Native the store can be
AsyncStoragewith async operations. In order to do this, I passedskipHydrationto the store and then ininitialize()started and await thestore.persist.rehydrate().This way at the point wagmi calls
getProvider()we know we have the store hydrated and the ZDWallet + the Session initialized and set in store. Soconnect()will definitely be called with the correct state.On Web: awaiting the hydration should be quick because the store is Sync. Also,
IndexedDBis much faster so theinitialize()should already be resolved by the timegetProvider()(andawait initialize()) is called.