I wrote a block plugin where users are able to create sticky notes. These notes are getting stored to DB when the user presses the save button or leaves the page. All database store operations are performed by a PHP and are invoked by Ajax requests.
However, when someone edits a note and refreshes the page, the note is getting saved to database, but it still represents the unedited version. It seems like the database query was faster than the record update earlier, because a new page refresh displays the edited note.
Is there a way to wait for pending database updates?