Inconsistency in window.Retool.subscribe

I am writing to seek your assistance with a recent intermittent issue we've encountered in our application, which uses a custom Mapbox component.

Introduction and Context: Our application integrates a custom Mapbox component, where polygon geometries are defined as a custom component model. These geometries are passed to the map component via the window.Retool.subscribe function. In the app, users select rows within a table, which triggers queries to fetch updated property geometries from our DB. The map is expected to render these geometries and zoom in on them, a functionality that has been stable for several months.

Issue Description: We have observed an intermittent issue starting last week, where the window.Retool.subscribe function does not consistently pass data into the map component. This problem occurs sporadically; it might work initially, but upon refreshing the app page, the functionality stops working. This inconsistency emerged without any recent changes or updates to our system.

Behavior and Impact: The expected and previously observed behavior is for the map to update and render the new geometries each time data is retrieved. However, due to this intermittent issue, the map fails to update consistently, leading to a degraded user experience and reduced reliability of our application.

Troubleshooting and Observations: In an effort to diagnose this problem, we placed console log statements in the map component's code. Notably, these logs do not trigger within the window.Retool.subscribe block during the instances when the function fails, suggesting an issue in the data transfer process.

Question and Request for Assistance: Is this intermittent functionality of the window.Retool.subscribe function a recognized issue on the Retool platform, or is it possibly unique to our implementation? We would greatly appreciate any insights, guidance, or suggestions you can provide to help us identify and fix this issue. Understanding and resolving this matter is crucial for the consistent performance of our application.

Hi @charliencx

There might be other causes to your issue.

Are you sure that on row selection, the data get changed properly?

Retool does dispatch to a Custom Component by means of subscribe callback only when the data, bound to the model, changes.

So, in order to properly debug this issue, you should check the whole data flow. An easy way is to put another component (not custom) that shows that payload, thus, you can narrow better where the problem is.

Hope this help

Thanks for the reply and suggestion. I am quite certain though that the data is flowing properly.

The data is passed into the custom map component via the propertyBounds value. When I select a row I can hover over the value an see that its is updating properly (see attached screenshots)

The table we use in the app was created as a module so that it can be used in multiple apps. One of the outputs of the module is the tableActivePropertyVersionID variable, which is updated when a row is selected. The propertyversion id is then used in the property boundary query. I can verify that selecting a new row updates this value and pulls in new boundaries (see attached screenshots).

Screenshot 2024-01-23 at 9.10.54 AM

Screenshot 2024-01-23 at 9.11.10 AM

What I am having trouble understanding is the intermittency of this problem. This morning I loaded up the app and it worked perfectly in its editable state. I then loaded the version available through a public url and it did not work. My thought then was that I had some updates in place that hadn't been released yet that may be causing the issue, so I created a new release. After doing that, the app in its editable state stopped working.

I have also noticed that I can get the map on the app to start working by going in and editing the map components mapbox code (i.e. add a console.log statement) and it starts working properly until I refresh the page.

Well, in that case there has to be an internal issue in Retool.
I've never experienced that, so far :slight_smile:

Determined what the underlying issue was. We have multiple apps that use an identical table component to display data. Do to this duplication, we had moved the table into a module, which is then imported in each app. Using this table module changed the order of how the components on the app page were being loaded, and the map was being loaded before the model was set. In our map component we had an if (model.bounds) {} block which was erroring out, because model was undefined at the time of loading. To fix, we simply updated to if (model?.bounds) {}

Thanks to everyone who took a look here.