开发者

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

开发者 https://www.devze.com 2023-02-06 00:58 出处:网络
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).

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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消