Skip to content

fix(wall-tool): null-guard wallPreviewRef writes (Sentry MONOREPO-EDITOR-D0)#371

Open
anton-pascal wants to merge 1 commit into
mainfrom
fix/sentry-MONOREPO-EDITOR-D0
Open

fix(wall-tool): null-guard wallPreviewRef writes (Sentry MONOREPO-EDITOR-D0)#371
anton-pascal wants to merge 1 commit into
mainfrom
fix/sentry-MONOREPO-EDITOR-D0

Conversation

@anton-pascal
Copy link
Copy Markdown
Contributor

Fixes Sentry MONOREPO-EDITOR-D0 (and duplicate MONOREPO-EDITOR-BE): TypeError: Cannot set properties of null (setting 'visible') firing in production at editor.pascal.app. Repro path: onGridClick fires once after the wall-tool component starts unmounting (level switch, tool change). The <mesh ref={wallPreviewRef}> has already been removed from R3F by the time the emitter listener runs, so wallPreviewRef.current === null when the line wallPreviewRef.current.visible = false executes inside the second onGridClick branch.

This PR guards that one remaining unguarded write with the same if (wallPreviewRef.current) style used in stopDrafting (which was guarded earlier in #323 — that PR caught one of the two writes from this crash family; this one was missed because it sits inside the second onGridClick branch rather than the cleanup path). No other changes; onGridMove already early-returns when either ref is null.

…ridMove

Sentry MONOREPO-EDITOR-D0: when the wall tool unmounts mid-click
(level switch / tool change), the emitter listener can fire after
the mesh is removed from R3F, leaving wallPreviewRef.current null.
Match the guard style at line 407.
@mintlify
Copy link
Copy Markdown

mintlify Bot commented Jun 4, 2026

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
pascal 🔴 Failed Jun 4, 2026, 4:10 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant