Steps to reproduce:
Result: changes to comments don't show up in the Reader unless you leave and go back. (1m33s)

Tested with WPiOS 14.0.0.0 TestFlight beta on iPhone 6S iOS 13.3.
After some extensive research into this issue I've found the following.
Also tagging @aerych to help verify my findings.
There is an issue in the app where Reader Posts and Comments are duplicated in the database.
The root cause of this issue is due to the way the reader creates/updates posts based on a topic. Due to this the reader will create a new post for each different topic which looks something like this:
Find the posts where the global ID is equal to '1' and the topic is equal to 'default'
NSString *globalID = remotePost.globalID;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"ReaderPost"];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"globalID = %@ AND (topic = %@ OR topic = NULL)", globalID, topic];
If the user then taps on the site name to open the site detail view the following happens except for a different topic such as:
Find the posts where the global ID is equal to '1' and the topic is equal to 'site-id'
This will return 0 results since the previous post was added for a different topic (followed sites), so the app will then insert a post object for that specific topic.
The same applies for posts loaded via Search, Tags, Discovery, etc because they are all different topics.
Looking at the database itself you can see this duplication of posts (I'm using emojies as the post title for visual reference):

Since we now know that each area a post can appear there is a different Post object, this means that when a comment is created it will attempt to be created for that Post object.
I say attempt because, when a user posts a comment or reply the following method is called:
- (Comment *)createHierarchicalCommentWithContent:(NSString *)content
withParent:(NSNumber *)parentID
postID:(NSNumber *)postID
siteID:(NSNumber *)siteID
Since this method does not take a Post object it instead attempts to find the post that the comment should be attached to using the postID and siteID and grabs the first result returned.
// Fetch the relevant ReaderPost
NSError *error;
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:NSStringFromClass([ReaderPost class])];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"postID = %@ AND siteID = %@", postID, siteID];
NSArray *results = [self.managedObjectContext executeFetchRequest:fetchRequest error:&error];
if (error) {
DDLogError(@"Error fetching post with id %@ and site %@. %@", postID, siteID, error);
return nil;
}
ReaderPost *post = [results firstObject];
if (!post) {
return nil;
}
This means the Comment could not be attached to the right post which means it won't appear until a network fetch is done and a new Comment object is created for the right Post object.
Diving a bit deeper into this I can see a few issues:
src="https://user-images.githubusercontent.com/793774/73878096-ca5c2580-480e-11ea-953a-79fd9e043a7b.png">
Sound spot on. :) Each topic gets its own set of posts and this leads allows for the scenario of one post having a different like status or comment count compared the same post in a different topic. (But corrected as soon as the topic (or post) is synced again.
Its been a known issue that comes up infrequently (maybe a handful of comments in something like four years?) and so something we haven't prioritized to patch.
Most helpful comment
After some extensive research into this issue I've found the following.
Also tagging @aerych to help verify my findings.
tl;dr
There is an issue in the app where Reader Posts and Comments are duplicated in the database.
Cause of the issue
The root cause of this issue is due to the way the reader creates/updates posts based on a topic. Due to this the reader will create a new post for each different topic which looks something like this:
Find the posts where the global ID is equal to '1' and the topic is equal to 'default'If the user then taps on the site name to open the site detail view the following happens except for a different topic such as:
Find the posts where the global ID is equal to '1' and the topic is equal to 'site-id'This will return 0 results since the previous post was added for a different topic (followed sites), so the app will then insert a post object for that specific topic.
The same applies for posts loaded via Search, Tags, Discovery, etc because they are all different topics.
Looking at the database itself you can see this duplication of posts (I'm using emojies as the post title for visual reference):
How does this relate to the comments?
Since we now know that each area a post can appear there is a different Post object, this means that when a comment is created it will attempt to be created for that Post object.
I say attempt because, when a user posts a comment or reply the following method is called:
Since this method does not take a Post object it instead attempts to find the post that the comment should be attached to using the
postIDandsiteIDand grabs the first result returned.This means the Comment could not be attached to the right post which means it won't appear until a network fetch is done and a new Comment object is created for the right Post object.
The broader issue
Diving a bit deeper into this I can see a few issues: