Skip to content

fix: event listener leak on outerConeAngle in light component inspector#1904

Open
willeastcott wants to merge 1 commit intomainfrom
fix/light-inspector-listener-leak
Open

fix: event listener leak on outerConeAngle in light component inspector#1904
willeastcott wants to merge 1 commit intomainfrom
fix/light-inspector-listener-leak

Conversation

@willeastcott
Copy link
Contributor

@willeastcott willeastcott commented Mar 5, 2026

Summary

  • Fix an event listener leak in the light component inspector. The outerConeAngle change handler (_resetInnerConeAngleLimit) was being registered inside _toggleFields(), which runs on every link() call and on every change to any of the 10 toggle-driving fields. This caused unbounded listener accumulation over repeated link/unlink cycles. Moved the subscription to the constructor so it is registered exactly once.

Test plan

  • Select an entity with a light component, verify inner/outer cone angle clamping still works (inner cone angle max should track the outer cone angle value).
  • Switch between entities with light components multiple times and verify no performance degradation from accumulated listeners.

@vercel
Copy link

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
editor Ready Ready Preview, Comment Mar 5, 2026 4:10pm

Request Review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Fixes an event-listener accumulation issue in the Light component inspector by ensuring the outerConeAngle change handler is subscribed exactly once per inspector instance (instead of being re-registered on every _toggleFields() call).

Changes:

  • Register outerConeAngle_resetInnerConeAngleLimit() change listener in the constructor (one-time).
  • Remove the repeated listener registration from _toggleFields() while keeping the immediate limit refresh behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

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