Offline Mode : Success Events Triggered Prematurely in Retool Mobile

Hi everyone,

I'm experiencing an issue with Retool Mobile's offline mode. Write-type queries are correctly queued when offline, but I've noticed that the "success" events for these queries are triggered before the app comes back online and the queued requests are actually executed successfully.

Is this expected behavior? If so, how can I ensure that "success" events only fire after the query is executed and confirmed?

Thanks in advance for your help

Hey @Wassim,

That is current behavior but we are actually working on this to make it more flexible.

You can customize the offline response type and write mocked response during offline mode.

Screenshot 2024-12-02 at 12.34.00 PM

If this is something that you are looking for this, send me your org name ! I can enable it for you.

Hi @james.lee !

Thanks for your answer.

I have a query that create/update an entity, and I want to use the response of this entity to start a second query after the first successfully ended (i need infos returned back by the server). I thought it would work as the success has to be fired when user get back online.

Mocking response doesn't seem to resolve my issue as the second query need the response of the first (not a mock, a response sent back by the server). It is a very critical issue so I'm trying to find something to go through this, because if we can't add a query that rely on the success of the previous query then offline mode is not usable.

Thank you!

Hi @Wassim, while our engineers work on making this more flexible, what if we set the offline response to return a k-v pair like {stopExecution: true}? Then, the success event handler of the first query could be a script that only runs the second query if there's no such key in the response.

For example:

if (firstQuery.data.stopExecution === true){
  console.log("Query stopped from running")
} else {
  await secondQuery.trigger()
}

Hi @Paulo

I tried this. Despite I setted an offline response, undefined data is returned by a 'write mode' query executed when app is running offline.

Could you share how we set the offline response?