Fix: centralize event listener management and cleanup on component destruction#9
Fix: centralize event listener management and cleanup on component destruction#9charuljain02 wants to merge 1 commit intoAOSSIE-Org:mainfrom
Conversation
📝 WalkthroughWalkthroughThe SocialShareButton class is refactored to introduce a centralized event listener management system. All direct Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~15 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
lgtm
however before merging we need to test it,
for that clone any of our frontend repo, identify its tech stack. based on that try to add Social-share-button by using readme of share-button repo.
but you need to manually import the social button because the README uses a CDN, which you won’t be able to change until I merge your PR into the main branch.
once done, share screenshots and recording with us.
|
see one of my tutorial for stablepay which is using next.js for frontend: https://www.youtube.com/watch?v=cLJaT-8rEvQ |
|
Hi! @kpj2006 Sorry for the delayed reply. I was debugging the issue and set up a small React (Vite) test project to reproduce the behavior by manually importing the SocialShareButton from the repository instead of using the CDN. I verified the functionality including: I’ve attached a short recording showing the ESC behavior and the button working correctly in the test environment. Please let me know if any additional testing or changes are needed. Thanks for your patience! social-share-button.mp4 |
|
join discord(link is in readme at top) discuss there. |

🐛 Problem
Event listeners (including document-level keydown listeners) were attached
during initialization but were not removed when the component was destroyed.
This caused potential memory leaks and unexpected behavior when the component
was mounted/unmounted multiple times (e.g. in SPAs or React apps).
✅ Solution
🧪 Testing
Summary by CodeRabbit
New Features
Refactor
#3
✏️ Tip: You can customize this high-level summary in your review settings.