Updated and expanded loading states for query hooks

Triplit's query hooks expose several loading states that give you granular control when rendering your UI. This week we've changed how fetching works and added fetchingLocal. To summarize:

fetchingLocal - for the local fetch from cache on the client.

fetchingRemote - for the fetch from the remote server when the client is setup to sync.

fetching which will be true initially, and then turn false when either:

  • The local fetch had cached results to return OR

  • There were no cached results and the remote fetch has completed.

If you're looking for the most multi-purpose loading state, fetching is the one to use. If you want to ensure that you're only showing the most up-to-date data from the server, you can use fetchingRemote. If your app is offline and you just want to wait for the cached data, you can use fetchingLocal.

Stay tuned

We're prioritizing server-side triggers, more robust authorization rules, new data types, and more. Check our roadmap for more details.