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

Fix the issue while deleting the comments. #1276

Merged
merged 2 commits into from
Oct 16, 2023

Conversation

Jai-Marothiya
Copy link
Contributor

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.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Jai-Marothiya! for creating this pull request and contributing to Dummygram! 💗

The maintainers will review this Pull Request and provide feedback as soon as possible! 😇
We appreciate your patience and contribution, Keep up the great work! 😀

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi there Jai-Marothiya!, congratulations on your first pull request :)

@Jai-Marothiya
Copy link
Contributor Author

Hi @narayan954,

Merge my pull request with the Hacktoberfest merge label.

Thanks.

@sonarcloud
Copy link

sonarcloud bot commented Oct 16, 2023

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

Copy link
Owner

@narayan954 narayan954 left a 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!

@narayan954
Copy link
Owner

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 narayan954 linked an issue Oct 16, 2023 that may be closed by this pull request
4 tasks
@narayan954
Copy link
Owner

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

@narayan954 narayan954 merged commit 1fb368f into narayan954:master Oct 16, 2023
7 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: deleting comment deletes oldest comment instead of selected one
2 participants