Closed mikebhart closed 2 years ago
At first glance, it looks like you're populating articlePosts
inside getArticleQueryBuilderData
which is running asynchronously, so it's likely that getInspectorControls
is returning before it's finished running.
Your best is probably to add articlePosts
to component state and run the fetch operation inside componentDidMount
. Or else if you can use hooks instead of a class component, you could leverage useEffect
for the fetching.
I'm going to go ahead and close this issue now.
Hello, Hope you can help.
Im fairly new to gutenberg so please bear with me.
I have the the following code, On my select onchange event I want the results from my fetch to reflect in my SearchListControl articlePosts. The problem is onchange results are returned without waiting for fetch to complete so I always get the result from the last onchange. I need a way of updating the inpsector controls SearchListControl articlePosts after my async function has been completed. Any ideas?