Network IO Requests + editDocument Across React Components

I’m calling out to an API that returns a JSON object to draw various objects on the canvas. The problem I’m having is the data call is invoked from one component (first page), then the results are passed up to App.jsx via props, then passed as a prop into a different component (second page).

From what I see, the best option would be to merge the two components together, and do the data call with an await/async call within the editDocument function like the example here. Then add some state management to switch out the UIs after the processes are complete. Is it possible to accomplish this while still keeping my current two component structure?

1 Like

Are you running into errors? You should be able to make data calls outside the editDocument function by using async/await and only use editDocument function when necessary. From what I hear from you, there should be nothing blocking to accomplish your workflow. If you could provide us what errors you are seeing, that would be helpful!

The error is:

Plugin Error: Plugin 98e084b7 is not permitted to make changes from the background. Return a Promise to continue execution asynchronously.

The problem I’m having is how to do async/await from one component to the other.

This seems to be more a react and async related issue, going to look into it further.