PacktPublishing / Full-Stack-React-Projects-Second-Edition

Full-Stack React Projects - Second Edition, published by Packt
MIT License
467 stars 540 forks source link

Comments and likes section do not get updated after adding a new post (MERN Social, chapter05) #42

Open 90sidort opened 3 years ago

90sidort commented 3 years ago

Hi, I have found an issue that is a bug. Short description:

GIVEN: User is logged AND Home page is opened AND There are older posts visible with comments and likes (e.g 1 like and 1 comment for the latest post) WHEN: User adds new post THEN: New post should not have any likes nor comments

New post is displayed on top of the previous comments and likes

Video available on request.

shamahoque commented 3 years ago

Hi @90sidort,

This consecutive post creation issue is happening due to an incomplete implementation. It wasn't covered in the book because it can be completed by extending the example of adding and removing posts. Basically, every time there is an update to a like or comment in a Post, we should also be updating the list of posts passed from the newsfeed.

You could do the following to complete this implementation:

This implementation is applied in the demo that I have hosted: social2.mernbook.com

Let us know if you find more issues or this needs more clarifications.