narayan954 / dummygram

DummyGram is a social media application where we have posts, stories, chat, friends, authentication, comment, delete, share and like feature. It uses ReactJs in the frontend for the UI and Firebase for the backend storing the users, posts, stories and comments.
https://narayan954.github.io/dummygram/
MIT License
76 stars 185 forks source link

Fix the issue while deleting the comments. #1276

Closed Jai-Marothiya closed 10 months ago

Jai-Marothiya commented 10 months ago

Fix the issue in deleting the comments: Basically when we delete the comment every time the last comment is deleted because when we use closure during the map it always takes the comment value that is the last one and always the last element it passes to deleteComment() function.

So I use one separate state that contains the id of a particular comment when it's deletion call.

Jai-Marothiya commented 10 months ago

Hi @narayan954,

Merge my pull request with the Hacktoberfest merge label.

Thanks.

sonarcloud[bot] commented 10 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

narayan954 commented 10 months ago

Fix the issue in deleting the comments: Basically when we delete the comment every time the last comment is deleted because when we use closure during the map it always takes the comment value that is the last one and always the last element it passes to deleteComment() function.

So I use one separate state that contains the id of a particular comment when it's deletion call.

that's a wonderful solution! thanks @Jai-Marothiya

narayan954 commented 10 months ago

please remember to mention issue number in prs. it helps a lot!