Skip to content

refactor(button): remove redundant constructor assignments in ButtonComponent#8669

Merged
willeastcott merged 1 commit into
mainfrom
refactor/button-ctor-dedupe
May 3, 2026
Merged

refactor(button): remove redundant constructor assignments in ButtonComponent#8669
willeastcott merged 1 commit into
mainfrom
refactor/button-ctor-dedupe

Conversation

@willeastcott
Copy link
Copy Markdown
Contributor

Summary

Remove dead duplicate field initialisations from the ButtonComponent constructor. The same seven fields (_visualState, _isHovering, _hoveringCounter, _isPressed, _defaultTint, _defaultSpriteAsset, _defaultSpriteFrame) are already declared as class fields with identical default values, so the constructor was writing them a second time.

The constructor retains its super() call and the lifecycle-listener wiring.

Pure internal cleanup — no behavioral change, no public API change.

Test plan

  • npm run lint — passes (only the single pre-existing unrelated warning in utils/rollup-build-target.mjs).
  • npm test — 1672 tests passing.

…omponent

Co-authored-by: Cursor <cursoragent@cursor.com>
Copy link
Copy Markdown
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

This PR performs an internal cleanup in ButtonComponent by removing redundant constructor assignments for fields that are already initialized via class field initializers, keeping the constructor focused on super() and lifecycle listener wiring.

Changes:

  • Removed duplicate initialization of seven private state fields from the ButtonComponent constructor.
  • Kept constructor behavior limited to super(system, entity) and _toggleLifecycleListeners('on', system).

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

@willeastcott willeastcott merged commit 530a012 into main May 3, 2026
12 checks passed
@willeastcott willeastcott deleted the refactor/button-ctor-dedupe branch May 3, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Request for a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants