'React-js with Firebase offline-persistance not working as Expected
App Works fine in Windows chrome but all this noted issues where found in Android chrome.
App works fine when user goes offline and firebase cache is also working and returning data even is offline but the problem is when user kills the app and re-open it then firebase is not returning any cached data.
STEPS :
- install as PWA.
- Close chrome and open as App.
- App is working fine.
- Now turn off the internet.
- Still app is accessing previous cached data and returning results (Works fine). ---- offline ---
- Now kill the app.
- Now Re-open. Firestore wont return the cached results as expected it just stucks in getDocs call. await getDoc() just stuck here and not executing the next line.
NOTE: App passes PWA criteria in Light house. Service worker has been added successfully and it was shown in DevTools service worker tab and we are also using workebox.
try {
enableIndexedDbPersistence(db);
} catch (error) {
window.alert(`${error.code} - Error in Persisting`)
console.error(error)
}
No error has been thrown
Any suggestions, What may be the problem ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
