Is it possible to call a loadData function after finishing another one?

Right now, we don’t have an official way of doing loadData(...).then(...), but we have a react hook called useEmbeddableState which you can use to “hack it” if you really need touseEmbeddableState basically allows you to pass state back and forth between your .emb.ts file and the react component (example here). Because of that, you can set up a flow like this:

  • first loadData runs in your .emb.ts file
  • results are passed to react component
  • you can use useEmbeddableState to pass appropriate state back to the .emb.ts file
  • .emb.ts file reacts to the change of state, and calls the second loadData call