Skip to content
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

[BUG] UI not updated on post Deletion #633

Open
ksraj123 opened this issue Sep 29, 2020 · 7 comments
Open

[BUG] UI not updated on post Deletion #633

ksraj123 opened this issue Sep 29, 2020 · 7 comments
Labels
bug Something isn't working HACKTOBERFEST

Comments

@ksraj123
Copy link
Contributor

Describe the bug
The UI does not update when a post is deleted. Request to delete the post to backend works as expected.

Steps to Reproduce
Step 1: Create a post
Step 2: Hit the API through postman to fetch the list of all posts, the post we created in step 1 would be in this list
Step 3: Delete the post though frontend
Step 4: Hit the API through postman to fetch the list of all posts, the post we created in step 1 would NOT be in the list but it's still visible on the frontend.

Expected behavior
The UI should update on the successful deletion of the post.

Screenshots
Peek 2020-09-30 05-07

Desktop:

  • OS: Ubuntu 20.04
  • Browser: Chrome
  • Version: 85

Additional context
Hacktoberfest

@ksraj123 ksraj123 added the bug Something isn't working label Sep 29, 2020
@trinadhmoganti
Copy link

@ksraj123 and @AuraOfDivinity, I'd like to fix this issue. Could you please assign it to me?

@lazycipher
Copy link

@trinadhmoganti I don't think anyone else is working on this issue! So, Maybe go ahead with solving this.
But before that may I know how are you planning to solve this?

@megabyte98
Copy link

I would like to fix this bug . Can you please assign this issue to me?

@trinadhmoganti
Copy link

@trinadhmoganti I don't think anyone else is working on this issue! So, Maybe go ahead with solving this.
But before that may I know how are you planning to solve this?

To me, it looksooks like it's an issue with state. I'm thinking that updating the frontend state after delete success api call should solve this issue.

@lazycipher
Copy link

@trinadhmoganti I don't think anyone else is working on this issue! So, Maybe go ahead with solving this.
But before that may I know how are you planning to solve this?

To me, it looksooks like it's an issue with state. I'm thinking that updating the frontend state after delete success api call should solve this issue.

I see that in postActions, we're dispatching getAllPost() which is trying to get all posts from the API. I think instead of trying to get all posts again, what we may do is use .filter() to remove the deleted post from the state on success.

@AuraOfDivinity, @ksraj123, @Rupeshiya, what do you say?

@Souvikns
Copy link

Souvikns commented Oct 4, 2020

@lazycipher I would like to work on this issue,
I can see that here there is a GET_ALL_POSTS that I guess is fetching the data from the API, If we create another action that takes the id of posts and returns a new list except for the one post, with the matching _id as you said earlier with using filter.

@lazycipher
Copy link

Fixed in some PR!
Please close @vaibhavdaren.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working HACKTOBERFEST
Projects
None yet
Development

No branches or pull requests

6 participants