This might be wise. Whenever someone clicks the save button and the unsaved things are sent to an API endpoint that person could then make a change to add a new unsaved item to the array before the API callback returns and drops everything out of the array. Maybe it is best if the process after the API call does not drop everything out of the array at the end of the promise returning as that could cost one some unsaved changes back at whatever means is being used to store a state stash at the UI. Instead at this point, the point of the promise returning, what was sent could be cross-compared to what is at the master records of unsaved changes and only items with the same timestamp could be discarded.
No comments:
Post a Comment