fix(editor): guard GLB export against undefined array-material slots (Sentry MONOREPO-EDITOR-79)#459
Open
anton-pascal wants to merge 1 commit into
Open
fix(editor): guard GLB export against undefined array-material slots (Sentry MONOREPO-EDITOR-79)#459anton-pascal wants to merge 1 commit into
anton-pascal wants to merge 1 commit into
Conversation
…(Sentry MONOREPO-EDITOR-79)
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Contributor
Author
|
Nightly Sentry triage (2026-07-06): MONOREPO-EDITOR-79 (isShaderMaterial) still firing in production (301 events, latest 2026-07-05 20:45 UTC, release 7838320f). Fix on this branch not yet deployed — this PR is still needed. No duplicate opened. |
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
Follow-up hardening for Sentry MONOREPO-EDITOR-79 —
TypeError: Cannot read properties of undefined (reading 'isShaderMaterial')(224 events, firing since 2026-04-22 through 2026-07-02) thrown fromthreeGLTFExporter.processMaterialAsyncduring the automated GLB bake/thumbnail path (userCount:0).The scalar-vs-array gap left by f75cffe
Commit
f75cffedadded a guard inpruneNonRenderableMeshesfor renderables whose material is scalar null/undefined:That only catches a scalar null. A mesh with an array material (multi-material / group geometry) where one slot was never assigned — e.g.
mesh.material = [validMat, undefined]— is never== null, so it slips through.isRenderableMeshthen returnstrue(the valid slot satisfiesmaterial.some((m) => m?.visible !== false)), so the mesh survives toGLTFExporter, which iterates every group's material and crashes onundefined.isShaderMaterial. That is the remaining trigger for this issue.Fix
In
pruneNonRenderableMeshes, after the existing scalar-null branch, handle the array case: for a renderable whose material is an array containing any null/undefined slot, fill the holes with the existing hiddenPLACEHOLDER_MATERIALand keep the mesh. The valid slots stay renderable; the exporter never sees anundefinedmaterial.PLACEHOLDER_MATERIALconstant.Tests
Added a
prepareSceneForExportunit test coveringmaterial = [mat, undefined]: after prune, the array still has both slots and every slot is non-null (noundefinedsurvives).Scope:
packages/editor/src/lib/glb-export.tsand its test file only. No dependency changes.Do not merge without review.
Note
Low Risk
Localized change to export-time mesh pruning with a matching unit test; no auth, data, or runtime behavior outside automated GLB bake.
Overview
Hardens GLB export against Sentry MONOREPO-EDITOR-79: meshes with multi-material arrays where a slot is
undefined(e.g.[validMat, undefined]) no longer reachGLTFExporter, which used to throw onmaterial.isShaderMaterial.In
pruneNonRenderableMeshes, after the existing scalarmaterial == nullhandling, any array material with null/undefined slots is normalized by mapping holes to the existing hiddenPLACEHOLDER_MATERIAL—the mesh is kept so valid slots still export.Adds a
prepareSceneForExportunit test asserting[mat, undefined]leaves a two-slot array with every entry non-null after prune.Reviewed by Cursor Bugbot for commit 48fc8c0. Bugbot is set up for automated code reviews on this repo. Configure here.