PersistedQueryClientProvider causing UI freeze in react native #10009
Replies: 2 comments 1 reply
-
|
hard to say without a runnable reproduction |
Beta Was this translation helpful? Give feedback.
-
|
This is a common performance bottleneck in React Native when using AsyncStorage with TanStack Query. The 2-3 second UI freeze happens because AsyncStorage is relatively slow, and once the data is retrieved, the JavaScript thread has to synchronously parse a potentially large JSON string of your cache, which blocks the UI. Here are the most effective ways to solve this, ranked from the "Proper Fix" to optimization steps.
If this switch to MMKV helps unfreeze your UI and navigation, please consider marking this as the accepted answer so it can help other Expo/React Native developers! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I have been trying to implement query persistence in my react native app made with expo.
The issue I am facing is that the UI freezes for 2 to 3 seconds when user opens the app and it blocks the navigation as well.
This is my HOC for the persistence provider:
Beta Was this translation helpful? Give feedback.
All reactions