Skip to content

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

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

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

mintlify Bot commented Jun 4, 2026

Copy link
Copy Markdown

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.

@anton-pascal

Copy link
Copy Markdown
Contributor Author

Heads-up for review: this PR overlaps with #392 — both guard wallPreviewRef.current in wall/tool.tsx (this one covers the line-545 write; #392 covers onGridClick entry + stopDrafting). Complementary guards, same Sentry family (EDITOR-BE / MONOREPO-EDITOR-D0). Best reviewed/merged together — or I can consolidate into a single PR on request.

@anton-pascal

Copy link
Copy Markdown
Contributor Author

Closing: superseded by #397 (merged aab48e0). Aymeric's 04880d4 includes the same wallPreviewRef null-guards (line-545 visible-write wrap) in wall/tool.tsx.

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