Open dukemarquis opened 4 years ago
I tried testing this and found that the Reader post detail page does refresh but only after you leave and come back. Here are the testing steps I did:
Results: posts updated after they are viewed in the Reader are not updated until you view the post and leave that view and go back. (1m34s)
Are my steps matching with yours? I wasn't sure about a few things in first testing step:
use your phone go the any post detail page
It's possible to go to the post detail page in multiple ways. I assumed that "use your phone" meant to use the browser on the phone in this case.
at this time, change this post text value or num_of_likes value
I assumed that editing the post directly is what you meant here.
use swipe refresh to refresh this detail page
I assumed you meant to go back to the published post in a browser on the phone.
The next step I'd like to take for this issue is to verify the exact testing steps, in detail, to confirm that I have them right and I would also like to know if the post does get updated if you repeat the process and then leave the detail post view and then go back.
my english is not very well, so sorry about some intricate expressions throughout my comment.
the right process is:
I think probably this is not an obviouly bug, it is something like a user experience issue. i guess maybe we can refresh all the row that have same 'post_id' in 'tbl_post' if the user swipe to refresh in 'Reader' page. because if the user already refresh the 'Reader' page and click the post to go to the detail page and see the data is not synchronous, they will feel wired.
sorry i click the close issue button accidentally
Expected behavior
in the method "updatePost" of ReaderPostDetailFragment, it triggers REST API to get the latest version of this post. After getting the newer version, in the "handleUpdatePostResponse" method, it triggers "ReaderPostTable.updatePost" method, that is where the wired behaviour comes.
wired behaviour :
in this method, first it updates the local tbl_posts database depends on the same pseudo_id. yes, in this process, it success updates. but after this, it triggers "addOrUpdatePosts" method with tag = null parameter then it causes the local tbl_posts database to create another post detail with exactly same as before except keep "tag" colomn empty.
for now, the local tbl_posts database has two rows with all the same information except different "tag" colomn. if i use my phone to navigate back to "Reader" page and refresh this page and at this time, if the owner of this post has changed this post (etc, text), i will get the newer text in the "Reader" page, but if i click this post and navigate to the detail page of this post, the detail page value won't change because this detail page uses data of "Old - unchanged row of this post" from the tbl_posts database.
i think this problem relates to the "2 same rows of the same post" in tbl_posts.
Steps to reproduce the behavior
use your phone go the any post detail page, at this time, change this post text value or num_of_likes value, and use swipe refresh to refresh this detail page. ( now, the local tbl_post database will have two rows of the same post )
then, return to Reader page in wordpress, change this post text or num_of_like value again, using swipe to refresh to refresh Reader page. ( now,the local tbl_post with two same rows of the same post will be different in the colomn of the value just changed )
if you go back to the detail page of this post again, you will find the value is different between this detail page and Reader page.
Tested on [ Pixel 3 ], Android [ API 29 ], WPAndroid [ 13.9 rc ]