-
-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix likecount bug on favourite page #653
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me!
If we pass id only we'd need to fetch individual post from db each by id for rendering. Currently We're passing the data to be rendered directly. Data for 10 posts(pagination limit) is generated in one query this way instead of querying for each id and rendered. This'd be like, if 1 query takes 200ms, 10 queries would take 2000ms and hence a delay in generating our home page posts which can be avoided by making a single query. |
what do you think now? |
Yes, I think you are right. A single query reduces the number of network round trips and improves overall performance hence, reducing network overhead. Thanks for explaining :) |
This PR fixed issue no. #627
The bug was due to the likecount array was not getting updated. On the home page the whenever we click the like button, updated props are passed to the Post component but, on favorite page when we click on the like button the props were not getting updated due to which I had to fetch the post itself in the Post component.
I think we also don't need to pass post(prop) to the Post component. As we are passing the postId as prop we can get all the updated data there(Post component) itself. What do you think @narayan954 ?
DummyGram.-.Google.Chrome.2023-07-04.18-54-05.mp4