angularfire
angularfire copied to clipboard
collectionData read operation crashes on physical iphone only with high result count
I ran into a very strange problem. When I read data from a collection with collectionData and it is a read that returns a high number of results, my app crashes on my physical iPhone (latest iOS) (both on web - Safari as well as in native app through Capacitor). It works fine on everything else, on my PC, on my Mac, on Android phones, even on my iPhone simulator on macOS.
On a physical iPhone if I limit the query to anything up to say 800 results it runs fine. Anything over 900 crashes the app. I tried reading data from two distinct collections, same behaviour. I am running Angular 17.0.2 and @angular/fire 16.0.0.
Anyone else ran into something like this?
Well, honestly loading this much amount of data can just cause a CPU and memory hog. use pagination, to get the data. I am pretty sure you will not be able to show around 800 results to a customer in a single instance. Read this guide https://firebase.google.com/docs/firestore/best-practices
But if you want to be completely sure, just check the system resources utilized while the app was running the query. If any of it just peaks, you know the issue if it doesn't, then try this https://ionicframework.com/docs/troubleshooting/debugging
- Connect your phone with usb debugging on the system
- Inspect the app in chrome debugging
- Open the performance tab and see for any lags or hiccups.