JacksonBates/pair-frontend

Deleting post doesn't free its position

Closed this issue · 6 comments

Deleting a post deletes it from the database on the server, but only hides it on the frontend. Its place stays hidden until the page is refreshed.

I think deleting should be performed by removing data from campers array in App.js, i.e. deleting function should be in App.js and be passed to Campers.js via props.

Well spotted.

Another related issue this causes is that when you add another one after having deleted one, the new one replaces the previous last, and the previous last covers up its 'younger' sibling.

eg:

Add card 1, 2, 3.
Delete card 1 (it disappears from top left, 2 & 3 stay in place)
Add card 4 (Card 4 replaces 3, 3 replaces 2, 2 is covered, top left is still blank)

I think #76 may have fixed this. Can anyone confirm? (Although it does seem to have added #78)

No it didn't.
Create 2 posts, delete the first, create another one (use different usernames).

Hmmm - I'm getting a slightly different bug, but I think you're right that it is still related.

I'm also noticing that the first post to an empty board doesn't necessarily appear without a refresh.

Hopefully fixed. See PR.