State machine not working as expected

Hi all,

I'm trying to use Retool Mobile since a few month and gave up in the past, because variables were not read as expected. It worked on the desktop but did not work in the mobile app. So I gave up. After I saw Retool Mobile left Beta I gave it a new try - however I still do not get it to work. Perhaps I do something wrong.
I really like the retool concept and would like to implement it here.

I have a relative simple example:
The app scans an ID and saves it as "hwid". With the hwid.value, a database request is fired which gives information about the product. The results of the query are shown in a table "Device info".
As a fallback to the scanner, the ID can also input manually which is also saved to hwid.

I works on my desktop when I try the app. When I run it on my phone, the table is not refreshed.

The query for the table has the watched input "hwid.value".

What drives me crazy is the different behaviour of mobile app and desktop mobile simulation. As there is no debugging in the mobile app itself I do not know how to move forward.
I also ditched the temporary states and moved everything to localstorage with similar results.

This stops me from implementing retool in our company.

Thanks for help
Best
Michael

Here's some ideas to try:

1. To "debug" in the app, add a text component and set its default value to {{hwid.value}}. That should show you whether the temp state variable gets updated as you expect it to.

2. Check if your query that has the watched input is set to be manually triggered or to run automatically when inputs change. If set to manual, try changing to run automatically when inputs change and see if that makes a difference.

3. You can try adding a button with an event handler that triggers the query when clicked.

4. Additionally, you can add another event handler to the button that shows a notification with the title set to something like: Value is: {{hwid.value}}

5. You can add Success and/or Failure event handlers to the query itself that show a notification accordingly. This will help in letting you know if the query actually succeeds or fails.

6. Make sure you don't have some condition in the query's Advanced > Disable query field that may block the query from running.

TIP:

If you want to get rid of the brackets in the Key/Value table, you can add a Transformer to the query and return the first row/entry only:

return formatDataAsArray(data)[0]

image

Or, if you want control on a per field basis, you can change it in the key/value properties:

image

Let me know how it goes.

Remember, that if you make changes to the app in the web editor, you need to reload the app on your device in order to to test them.

You can do this in a few ways:

  1. Simply force close the Retool app on your device and then launch it again.

  2. Or, in the Retool app, open the drawer menu (swipe from left) and switch to any other app. Then, switch back to the app you're working on.

  3. Or, use my "Reloader" approach that basically automates the process of step 2 above.