You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a question about React Native and cache. I have set the cacheLife option to enable the cache. Even if the value is set, there is always a network request made.
But, if I enable debugging in the app with for example React Native Debugger and enable Network Inspect, the cache mechanism seems to work like it should. The data is cached for the amount of time set in the options. But as soon as I disable the debugger, nothing is cached again.
I'm using a Provider to set the url and the options: <Provider url={API_URL} options={options}> {children} </Provider>
Setting up with useFetch: const { get, post, response, loading, error } = useFetch(API_URL);
Hi!
Describe the bug
I have a question about React Native and cache. I have set the cacheLife option to enable the cache. Even if the value is set, there is always a network request made.
But, if I enable debugging in the app with for example React Native Debugger and enable Network Inspect, the cache mechanism seems to work like it should. The data is cached for the amount of time set in the options. But as soon as I disable the debugger, nothing is cached again.
I'm using a Provider to set the url and the options:
<Provider url={API_URL} options={options}> {children} </Provider>
Setting up with useFetch:
const { get, post, response, loading, error } = useFetch(API_URL);
Calling get:
const myData = await get('/api/mydata?filter=' + filter);
Expected behavior
Setting the cacheLife option > 0 should cache the data in React Native
Any idea why this could be happening? I have tried on both simulator and device and it's the same problem on both.
The text was updated successfully, but these errors were encountered: