I'm currently facing challenges in effectively managing and manipulating data retrieved from a backend API within an Angular 2+ service.
Take for instance the creation of a cart system. Upon sending an initial get
request to fetch the current cart details from the backend, I encounter difficulties in efficiently handling this data.
What is considered the optimal approach for updating this data? Simply executing a put/post request may not trigger updates on components subscribed to the data. On the other hand, performing another get
request to obtain the updated data might result in the new values being fetched before the backend logic processes the update and returns the modified data. Utilizing Subjects
presents its own set of challenges as well.
This task appears to be quite common, yet I can't seem to pinpoint any obvious solutions that I may be overlooking.
If tasked with developing a cart system, or similar functionality that initially retrieves data from a backend and necessitates subsequent updates, how would you navigate through handling this data - what workflow would you adopt?