Skip to content

refactor: remove dead this.controller references from AppBase and hide Controller class#8644

Merged
willeastcott merged 1 commit into
mainfrom
refactor/remove-controller-ghost
Apr 23, 2026
Merged

refactor: remove dead this.controller references from AppBase and hide Controller class#8644
willeastcott merged 1 commit into
mainfrom
refactor/remove-controller-ghost

Conversation

@willeastcott

@willeastcott willeastcott commented Apr 23, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Remove the two dead if (this.controller) { ... } blocks from AppBase.inputUpdate and AppBase.destroy. Workspace-wide grep (engine + editor + supersplat + react + web-components and the other first-party repos) turns up zero places that ever set, declare, subclass-override, or read app.controller, so both guards are permanently false.
  • Hide the orphaned Controller class (src/platform/input/controller.js) from the public API reference by swapping @category Input for @ignore on its class-level JSDoc. No engine code constructs one, no AppOptions wires one in, and no component uses it.
  • The runtime export (export { Controller } and the re-export via src/index.js) is kept, so any existing user code that does new pc.Controller(...) keeps working. Only the documentation surface changes.
  • The Controller-only constants (ACTION_*, AXIS_*) in src/platform/input/constants.js are left untouched: they're bare export const declarations with no JSDoc, and typedoc.json has "excludeNotDocumented": true, so typedoc already omits them.

Net diff: +1 / -8 across two files.

Test plan

  • npm run lint (clean; only a pre-existing unused-disable-directive warning)
  • npm run build:types (succeeds; Controller still emitted in build/playcanvas.d.ts)
  • npm test (1652 passing, 2 pending, 0 failing)
  • Spot-check next API-reference build: Controller no longer listed in the Input category or elsewhere.

…ide Controller class

The `this.controller` property on AppBase is a legacy carry-over: it is
never set, declared, or consumed anywhere in the PlayCanvas codebase, so
both `if (this.controller)` guards (in `inputUpdate` and `destroy`) are
permanently false. Remove the dead blocks.

The standalone `Controller` class in `src/platform/input/controller.js`
is the (likely intended) type those references held, but it is now
completely orphaned - no engine code constructs it, no AppOptions wires
it in, and no component uses it. Mark it `@ignore` so the API reference
generator drops it. The runtime export from `src/index.js` is retained
so any existing user code doing `new pc.Controller(...)` keeps working.

Made-with: Cursor

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Refactors input-related code by removing unused AppBase references to an unused controller field and hides the orphaned Controller input helper from the generated API docs (while keeping the runtime export for backwards compatibility).

Changes:

  • Removed dead this.controller update and teardown blocks from AppBase.
  • Marked src/platform/input/controller.js Controller class as @ignore so it no longer appears in the API reference.

Reviewed changes

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

File Description
src/platform/input/controller.js Switches Controller class JSDoc from @category Input to @ignore to remove it from generated docs while keeping export.
src/framework/app-base.js Removes unused this.controller update and destroy logic from the app input loop and teardown.

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

@willeastcott willeastcott merged commit 5c09ae4 into main Apr 23, 2026
12 checks passed
@willeastcott willeastcott deleted the refactor/remove-controller-ghost branch April 23, 2026 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: input Input related issue

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants