Forum Discussion

RizuGulati's avatar
RizuGulati
Qrew Cadet
8 years ago

Force refresh a page after webhook has changed data

I am using a webhook to update some tasks (ex. task B and C) as complete in a table once a particular task (task A) is marked as complete. So when I mark task A as complete, the page is refreshed and it removes A from the list since it's completed. In the background, the webhook is triggered and it updates B and C as complete. 

However, I still see B and C visible when the page is redirected after I change task A. I believe there is a delay while the webhook is making changes, therefore, I have to refresh the page a second time to see the change. I don't want to have our users refresh the page twice every time they make these updates.

Is there a way to force reload a page in this scenario? Or any other solution that might help here?

Thanks.

7 Replies

  • If you are familiar with networking concepts you can think of a webhook as similar to a UDP Packet - it may or may not arrive. If you need a page refresh after some user action you should use script instead as the script can immediately react to user actions.
    • RizuGulati's avatar
      RizuGulati
      Qrew Cadet
      Thanks Dan.

      So just for clarification, rather than using a webhook altogether I should use script to perform cascading updates in this case and refresh the page when the data has been changed. Correct?
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    If script is not your strength, you can also do this with the current relationships you have.  And using formulas to automatically "complete" sequential tasks.

    I know Dan is a master at script and a great advocate for it, but I thought I'd give you another option
    • HeatherBryant2's avatar
      HeatherBryant2
      Qrew Assistant Captain
      Hi Matt,
      I am working with a Quick Base Action and am running into the same as Rizu mentioned above - the 1 or 2 second delay and having to refresh 2 times.

      I am working with a summary field in a master table and because of the refresh issue, it is not getting populated because essentially the child record hasn't yet been created to populate it.

      You mentioned using a formula as work around, what would that look like?

      Thanks! 
  • This is a fundamental problem with Webhooks - in the current implementation you can't chain Webhooks together in a reliable way and because they are rate limited you can't even guarantee the initial Webhook will fire in the first place.

    But there is an easy solution using script. If you use the API to mark task A as complete you can further process task B and C only after task A's processing is completed. This property of chaining together asynchronous processes is called "thenable". Webhooks are not "thenable" in their current implementation but there are simple ways to make API calls "thenable" (ie chainable) using jQuery or the Fetch API.