Skip to content

How to retrieve message from postMessage ? #28

@FlorianRuen

Description

@FlorianRuen

Hello there,

I'm new user of Retool (just a week ago), and I want to display a custom loading component, while the react-retool is loading. To do this, I'm looking to send a message when all the requests are loaded, so my react application, can change a loadingState from true to false or something else

The postMessage seems working, but I can't retrieve the message on my react application

  onRetoolDataReceived = event => {
    console.log('Data from Retool');
    console.log(event.data);
  };

<Retool
  url=[APP]
  onData={this.onRetoolDataReceived}
  data={{
    from: 'YYYY-MM-DD',
    to: 'YYYY-MM-DD',
  }}
/>

In this case, the function is called, because I see the first console.log, but for the second one, nothing is displayed
The message I send in postMessage function is

parent.postMessage(
     {
          type: "REQUEST_FINISHED",
          name: 'request_1',
          id: 'request1_loaded',
          loadingTime: '12ms',
     },
    
     [MY_APP_PUBLIC_URL]
)

Any ideas ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions