Repository navigation
[Bugs] viewer, nodes: pointer moves no longer throw on a wall mid paint preview - #1116
Merged
Merged
Conversation
…e pair applyWallPreview regrouped the geometry and swapped the material through two independent restores: the material went back whenever the mesh still wore the preview, the groups only while the geometry was the same object. A rebuild during the preview put the older, shorter palette over the new geometry's groups, leaving a group with no material (MONOREPO-EDITOR-131/132). swapPreviewMaterial now takes the groups with the material and restores the original material only over groups it can draw.
…array on the stock path too The cached collector already skipped them, but once an event fell back to three's recursive intersectObject (any untagged custom raycast in the scene) a torn wall threw on material.side from every pointer move (MONOREPO-EDITOR-131/132). The stock walk now mirrors three's recursion with the same guard. Each skip reaches the host once per mesh and material as a raycast_invalid_material breadcrumb with the owning node's type and id, through <Viewer onBreadcrumb> / <Editor onViewerBreadcrumb>. The #1091 elevator regression test now drives pointer moves over the same torn wall on both the cached and the stock path.
Aymericr
marked this pull request as ready for review
October 21, 2026 12:19
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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.
What does this PR do?
Fixes MONOREPO-EDITOR-131 and MONOREPO-EDITOR-132 (
Cannot read properties of undefined (reading 'side')frompointer-events.js:368on pointer move).Both Sentry stacks crash on the stock fallback branch of the vendored pointer manager (
layer.raycaster.intersectObject(obj, true)), not the cached collector. #1091 guarded the elevator click raycast and the cached collector, but once an event falls back to three's own recursion (any untagged custom raycast in the scene), a wall whose geometry groups point past its material array still throws.nodes):applyWallPreviewregrouped the geometry and swapped the material through two independent restores. A rebuild during the preview put the older, shorter palette back over the new geometry's groups.swapPreviewMaterialnow takes the groups along with the material and swaps them as one pair. On undo it puts back only what is still the preview's, and restores the original material only over groups it can draw. The other paint previews (material-only) get the same "never restore a palette over groups it can't draw" rule.viewer): the stock path now usesintersectDrawable, which mirrors three's recursiveintersectObjectbut skips mesheshasMaterialsForGroupsrejects (their children are still tested). Raycasters with their ownintersectObjectare still asked directly.raycast_invalid_materialbreadcrumb{ category, message, level: 'warning', data: { nodeType, nodeId, objectName } }. It reaches the host through the new<Viewer onBreadcrumb>prop, forwarded as<Editor onViewerBreadcrumb>. The public packages carry no Sentry SDK, so the hosted app needs to wire it, e.g.onViewerBreadcrumb={(b) => Sentry.addBreadcrumb(b)}.createPascalPointerEventsover the same torn wall, on both the cached and stock paths. It asserts no throw, that the hover target behind the wall still getsonPointerMove, and that exactly one breadcrumb is recorded withnodeType: 'wall'and the node id. With the old stock call put back, the stock case fails withmaterial.side.How to test
bun test packages/viewer/src/systems/elevator packages/viewer/src/lib/pointer-events.test.ts(afterbun run build): all pass.bun test packages/nodes/src/shared/swap-preview-material.test.ts: the groups and material undo as a pair, and a rebuilt geometry keeps the preview palette instead of getting the shorter original.Screenshots / screen recording
N/A: non-visual change.
Checklist
bun devbun checkto verify)mainbranchNote
Medium Risk
Changes core pointer raycasting and wall paint preview teardown; behavior is guarded and tested but affects hover/picking whenever material arrays and geometry groups disagree.
Reviewed by Cursor Bugbot for commit 3a88c84. Bugbot is set up for automated code reviews on this repo. Configure here.