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: return a cleanup function from PopupPage's useEffect hook #110

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nicomiguelino
Copy link
Collaborator

Issues Fixed

Up[dated PopupPage's useEffect hook to return a function that cleans up event listeners on component unmount.

Description

A Copilot review comment in #108 says that the event listener added in the useEffect hook of the PopupPage component is not removed on component unmount.

Checklist

  • I have performed a self-review of my own code.
  • New and existing unit tests pass locally and on CI with my changes.
  • I have tested my changes on Google Chrome.
  • I have tested my changes on Mozilla Firefox.
  • I added a documentation for the changes I have made (when necessary).

@nicomiguelino nicomiguelino requested a review from Copilot March 6, 2025 17:44

Choose a reason for hiding this comment

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

PR Overview

This PR fixes the event listener cleanup issue in PopupPage by refactoring the useEffect hook.

  • Extracts the event listener callback into a named constant.
  • Adds a cleanup function to remove the event listener on component unmount.

Reviewed Changes

File Description
src/assets/ts/popup.tsx Refactored useEffect hook to attach and clean up the event listener

Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.

@nicomiguelino nicomiguelino requested a review from vpetersson March 6, 2025 17:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant