#Issue with pagination and social media posts disappearing when clicking like.(React)

13 messages · Page 1 of 1 (latest)

inland vortex
#

Here's my GitHub Gist https://gist.github.com/bcova/eabfba382c5093a114f9d008cd5713f4

Hello, I have a social media app i am developing and i have enabled pagination with 5 posts per page. My issue is that if i click on the first post being that its on the last page (assuming newest post is at top, first page) no matter which one i click on it deletes the first post on the last page??

Gist

Issue with pagenation . GitHub Gist: instantly share code, notes, and snippets.

long juniper
#

Recorded a full video and posted the code without being asked 10 times this definitely deserves help, if no one else jumps in I'll take a look when I'm back home 🙏

inland vortex
#

@long juniper Thank you so so so so much!!! I am proud of what i've made so far, just can't seem to understand this issue! If more code is needed or context, feel free to reach out and i can make more videos and share more gists!

long juniper
#

If I haven't responded in 4 hours or so feel free to ping me btw

inland vortex
long juniper
#

Suggestion: Why do you have a different endpoint for liked posts? I think it'd make sense to also return the like data in your response from the posts endpoint.

inland vortex
#

Oh no, it’s not for liked posts, it’s just the likes themselves,lol. So that just pulls back an array of post ids that the user has liked

#

But it’s all under my post route

#

Idk why I return them separate?

#

I think it was because I have a separate likes table in my psql DB but I can just join the likes on the main post get request

inland vortex
#

another weird thing im seeing, i logged the users posts on line 275 but as you can see it's not recognizing that last post?? if i like any other posts it'll delete that 1 post.

long juniper
#

Where's the code for the get? Your gist only contains the POST iirc

quaint reef