I was trying to figure out how caching works for a Listview with Firebase. I tried two ways: Filter a Firebase Query directly from a dropdown, or have the dropdown update an App State and then have that App State filter the Firebase Query.
Filter a Firebase Query directly from a dropdown.
When I choose a value from a dropdown, that dropdown value is what is used as a filter for a firebase query.
The dropdown updates an App State and then have that App State filter the Firebase Query.
Here are the results, using the color codes. As you can see, when I filter the ListView directly from the dropdown value (purple/pink), I read from the database every time the dropdown changes. So it seems like caching doesn't work with this setup.
If I use the dropdown to update an App State and then that App State is what is used to filter the firebase query then the reads are reduced (green). It looks like caching works with this setup.
In each situation I changed the dropdown seven times, with there being only two options in the dropdown.
Maybe someone else can confirm this. Also, why does it work with the App State and it doesn't work otherwise? Maybe it's because when updating the app state in the Actions popup it rebuilds the page and, somehow, that makes the difference?