Skip to content

refactor: Remove unused _batchGroup field from batched components#8673

Merged
willeastcott merged 1 commit into
mainfrom
remove-dead-batchgroup
May 3, 2026
Merged

refactor: Remove unused _batchGroup field from batched components#8673
willeastcott merged 1 commit into
mainfrom
remove-dead-batchgroup

Conversation

@willeastcott

Copy link
Copy Markdown
Contributor

Summary

  • Removes the unused private _batchGroup field from ModelComponent, ElementComponent, and SpriteComponent.
  • Removes the three corresponding write sites in BatchManager (_extractModel, _extractElement, _collectAndRemoveMeshInstances).

Details

The _batchGroup field was declared on three components and assigned from three places in BatchManager, but never read anywhere in the engine, tests, examples, or any consuming repo (editor, supersplat, web-components, etc.). Most writes were // #if _DEBUG-gated, signalling they were once intended for inspection tooling that no longer exists. The sprite write was not gated — an additional inconsistency in otherwise dead code.

Note: BatchManager._batchGroups (plural, on the manager itself) is the actual source-of-truth lookup and is unrelated to this change. The public _batchGroupId field on components is also retained.

No public API is affected; the field was never documented.

Test plan

  • npm run lint — clean.
  • npm test — 1672 passing, 0 failing.

The private _batchGroup field on ModelComponent, ElementComponent and SpriteComponent was never read anywhere in the engine, tests, examples, or any consuming repo. Most write sites in BatchManager were already #if _DEBUG-gated, indicating they were once intended for inspection tooling that no longer exists.

Co-authored-by: Cursor <cursoragent@cursor.com>

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

Removes a dead private _batchGroup field from several batched components and deletes the corresponding (now-unused) assignments in BatchManager, keeping batching behavior based on _batchGroupId / BatchManager._batchGroups unchanged.

Changes:

  • Removed _batchGroup private field from ModelComponent, ElementComponent, and SpriteComponent.
  • Removed writes to component._batchGroup in BatchManager extraction/collection code paths.
  • Kept existing batching identifiers (_batchGroupId) and manager state (_batchGroups) intact.

Reviewed changes

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

File Description
src/scene/batching/batch-manager.js Removes unused debug/inspection assignments to ._batchGroup during batch extraction/collection.
src/framework/components/sprite/component.js Deletes unused private _batchGroup field from SpriteComponent.
src/framework/components/model/component.js Deletes unused (debug-gated) _batchGroup field from ModelComponent.
src/framework/components/element/component.js Deletes unused (debug-gated) _batchGroup initialization from ElementComponent.

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

@willeastcott willeastcott merged commit 35dc6a6 into main May 3, 2026
12 checks passed
@willeastcott willeastcott deleted the remove-dead-batchgroup branch May 3, 2026 16:56
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