Retool Mobile offline mode

Learn how to configure Retool Mobile apps for offline use.

πŸ“˜

Offline mode is available on the Business plan.

Offline mode makes it possible for Retool Mobile apps that run natively to continue functioning without a data connection. When enabled, queries that read data can cache the most recent results to make them available offline. Queries that write data are held in a queue and run once the data connection is restored.

Considerations

If you plan to use offline mode, keep in mind the following considerations.

Read queries only cache data when viewed by the user

Queries configured to read data for offline mode only cache data when the user views the results. The user must navigate to screens and view the query data at least once while connected.

If you need to download data in advance, consider using LocalStorage to temporarily download data that can be accessed when offline.

Write queries run sequentially

Queries configured to write data in offline mode run sequentially when the connection is restored. If one query fails due to a conflict, the user must resolve it before any remaining queries can run.

Write queries cannot have dependencies

Queries with pending changes in offline mode cannot depend on any other queries. For example, if you have a customer management app that is offline, the user could not create a new customer record and then refresh the list of customers. Similarly, the user could not create a new customer record offline and then make further changes.

Enable offline mode

Offline mode is available on a per-app basis and enabled in the App editor. Click β€’β€’β€’ to open the App actions menu, select Mobile app settings, then toggle Mobile offline mode on.

Enable offline mode

Retool Mobile attempts to trigger pending queries automatically. You can require users to manually trigger pending queries that write data by toggling Mobile offline mode delay sync.

When offline mode is enabled, your app displays a connection status bar at the top of each screen.

  • Connected or Reconnected (green): The app is connected to Retool.
  • Offline (amber): The app is not connected to Retool and is operating in offline mode. The status includes the number of pending changes.
  • An error has occurred (red): The app is unable to reconnect or cannot perform pending changes.

Offline mode status

Configure offline query types

You must configure the Query type for each query that should be available in offline mode:

  • Read: The query reads data. The app caches the most recent data returned by the query and makes it available offline.
  • Write: The query writes data. The app enqueues these queries and triggers them when the connection is restored.

Select a query in the bottom panel, navigate to the Advanced tab, and specify the Query type in the Offline section.

Configure offline query type

View query status

The Job Manager contains a list of failed, pending, and completed queries. Tap the connection status bar at the top of the app screen to open it. Each entry contains the query name and date. Users can remove pending queries by pressing Remove.

Job Manager with pending changes

Offline write queries can display key-value pairs in the Job Manager. You configure these using the Display body fields in the Offline section for a query.

Configure display body

Display body values can help provide context on the pending changes, such as displaying the original and modified values.

Display body key-value pairs

Run pending changes

Retool Mobile automatically processes pending queries once the connection is restored. If Mobile offline mode delay sync is enabled, the Job Manager includes an action button to manually trigger the queriesβ€”users must press this for changes to occur.

Manually trigger pending queries

The Job Manager processes each pending change sequentially. If a query fails for any reason, such as a conflict in data, the user must resolve this by retrying or removing the failed change. Any remaining queries will remain in a pending state until this is completed.