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

Prevent MutationObserver error when removedNodes is empty #836

Merged

Conversation

MOBermejo
Copy link
Contributor

This PR fixes a bug on the faction page that caused an error when removedNodes was empty.

The MutationObserver listens for changes to the faction member list, but if removedNodes is an empty NodeList, it triggered the following error: Cannot read properties of undefined (reading 'matches')

  • Added optional chaining (?.) to prevent the script from calling .matches() on undefined.
  • Ensures the observer safely continues when removedNodes exists, but is empty

@DeKleineKobini
Copy link
Collaborator

Any changes should be added in the extension/changelog.json file under the first unreleased version.
First contributions should also update extension/ scripts/global/team.js to add yourself as member and choose a color for in the changelog.

CONTRIBUTING.md

Other than that, it will do as a temporary fix. Created #837 for a more permanent fix which wouldn't break as easily when Torn changes anything.

@DeKleineKobini DeKleineKobini merged commit e5acedd into Mephiles:master Feb 16, 2025
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.

2 participants