Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Anyone know of a good pattern for keeping a user interface consistent whilst using eventually consistent data updates

Scenario is a grid with a list of contacts. User clicks on 'send email' from grid, sends an email. We drop a message in a queue to update some aggregates (which are also displayed on the list).

The problems is after sending the email, the aggregates are not guaranteed to be updated yet.

We could update the count with javascript, but what if they refresh the page and the aggregates have not yet completed?

like image 329
Tom DeMille Avatar asked Nov 15 '22 04:11

Tom DeMille


1 Answers

One approach would be to keep track of the data in a cookie. On a refresh (i.e., page load) you can check for the existence of the cookie and read (and display) its value via JavaScript. The process that updates the aggregates could also read the cookie and update it, if necessary, to ensure the values are in sync once the updates are complete.

like image 184
Chocula Avatar answered Dec 03 '22 05:12

Chocula