I am trying to deal with similar issues for a WPF client. The re-request trigger for any data depends on the data of your update, the teams usually fall into the categories:
A command is a true fire and forget method, it informs about the state of a state change, but this change does not need to be reflected in the user interface, or the change is simply not important for the user interface.
The command will change the result of a single request
The command will change the result of several queries, usually (in my domain, at least) in a cascading way, that is, changing the state of one "high" part of the data is likely to affect many "low level" ones.
My first trigger is page loading, very few elements are exempted from this, since most pages should assume that the data has been updated since the last visit. Despite the fact that some systems can escape, only in this way updating financial and other critical data.
For short commands, I also update the data when the success command returns from the command. Although this is mostly laziness, since IMHO all CQRS commands should be run asynchronously. This is still an option that I could not have lived without it, except for one that you might need if your implementation expects a high delay between the command and the request.
One template I'm starting to use is the mediator (most MVVM frameworks have one). When I run the command, I also launch a message to the broker indicating which command was run. Each Cache ( Retriever<T>
view model property) listens for commands that affect it, and then updates accordingly. I try to minimize the number of messages, while still minimizing the number of caches that update the unnecessary from a single message, so I (hopefully) end up with a short list of reasons for the update, with each "reason" updating the list of caches.
Another approach is simple honesty, I find that by demonstrating graphically how the system updates itself, users become more willing to be patient with it. When you run the command, display some user interface that indicates that you are expecting a successful response if there is an error that you might suggest to repeat / show the error if the update fields for the corresponding fields are successfully started. Bearing in mind that this command could be launched from another terminal (which you do not have knowledge of), therefore, in the end, the data will need a timeout to avoid missing state changes caused by other machines.
Noting the irony that the only effective way to update the cache and values on the client is to cancel the commands and requests again, whether using hard coding or something like a hash map.
source share