I have built an app that allows a user to ask a question in a form block and to see the answer in a custom code block immediately below. That happens via the question being sent with zapier to a flask app endpoint, generating a response, and then the response being sent to another flask app endpoint and the custom code fetching it.
The issue with this approach is that the data displayed is the most recent data in the post request.
I actually want the user to only be able to see the answer to the question that they generated.
Has anyone encountered this before and have any idea how to fix?
maybe … @dcolletta…?
Ty for any help!
I’m having trouble imagining how you are getting this behavior.
Is it a timing issue? Are you trying to pick up the response before it is ready, and getting the previous one instead?
Or do you have a hypothesis about why this is happening?
Not currently happening.
I am imaging a future world in which there are multiple users using my app at the same time.
All generating a post request (by asking questions) and then not seeing the answer that corresponds to the question they asked.
I’m having trouble visualizing exactly how all the pieces are connected here.
If the entire process is synchronous, so that the browser’s request to Zapier does not return until the answer text is available, then you should not have any problems with a response being sent to the wrong user.
However, if there are asynchronous pieces, where the browser sends the request and then asks for the answer later, then you will need some kind of request id to be generated when the browser first sends the request to Zapier, and returned in that first request. Then the browser can specify the request id when it asks for the answer text, and you can look up the answer to return using that request id.
If I were building this, I would try to stay away from the request id approach, since it is more complex and has more ways to go wrong. It would be best if the HTTP response from the initial browser request contained the answer text.