refactor: Remove unused _batchGroup field from batched components#8673
Merged
Conversation
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>
Contributor
There was a problem hiding this comment.
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
_batchGroupprivate field fromModelComponent,ElementComponent, andSpriteComponent. - Removed writes to
component._batchGroupinBatchManagerextraction/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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_batchGroupfield fromModelComponent,ElementComponent, andSpriteComponent.BatchManager(_extractModel,_extractElement,_collectAndRemoveMeshInstances).Details
The
_batchGroupfield was declared on three components and assigned from three places inBatchManager, 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_batchGroupIdfield 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.