ParentWindow query not returning results

  • Goal: I'm working on integrating Retool Embeds into my existing application. As part of the embed flow, I want to pass in a clientUuid using the data prop in react-retool. The retool app is then supposed to use a ParentWindow query to access the property, store it in a Global Variable and then other Resource queries are using it to load the right data from our API.

  • Steps: I'm initializing the Retool React Embed component using this code:

<Retool url={embedUrl} data={{ clientUuid: 'myUUID'}} onData={(data) => {
              console.log('received data', data);
            }} />

I have my ParentWindow query configured like this:

However, the Variable ClientUuid never receives a value. I have added a secondary success handler that uses parent.postMessage to send the value back to my code, but it's also only sending undefined. However, looking at the console in my parent application, I do see the following log returned by Retool, indicating that the ParentWindow Query indeed ran successfully and returned the right value:

To summarize: It looks like extracting the passed in data is working properly, but the result of the ParentWindow query does not appear to be usable.

Hello @Tim_Specht1!

Very odd that you are able to see the data passed back from the Retool embedded app to the parent app as seen in your last screenshot, but that the parentWindow query is not taking the data it receives and passing it to the ClientUUID variable :thinking:

Let me test this out on my end and see if I get the same behavior.

Just to confirm, when you manually run the parentWindow query, is it giving you an error or displaying no data in the query output?

You mentioned that a " secondary success handler that uses parent.postMessage to send the value back to my code" but that is returning undefined, are you using another method to pass data to the parent app as displayed in the last screenshot? Or did the one parent.postMessage start working now?

Could you share a screenshot of the success event for ClientUUID.setValue()?

One quick way you could test out the query+success event would be to set it up as I have in my screenshots below, and use something like a text component and set it to ClientUUID.value and then after the parentWindow query runs inspect this component to see if the data reaches the display component.


CleanShot 2024-11-08 at 09.05.58@2x