fix(wall-tool): null-guard wallPreviewRef writes (Sentry MONOREPO-EDITOR-D0)#371
Open
anton-pascal wants to merge 1 commit into
Open
fix(wall-tool): null-guard wallPreviewRef writes (Sentry MONOREPO-EDITOR-D0)#371anton-pascal wants to merge 1 commit into
anton-pascal wants to merge 1 commit into
Conversation
…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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
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.
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:onGridClickfires 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, sowallPreviewRef.current === nullwhen the linewallPreviewRef.current.visible = falseexecutes inside the secondonGridClickbranch.This PR guards that one remaining unguarded write with the same
if (wallPreviewRef.current)style used instopDrafting(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 secondonGridClickbranch rather than the cleanup path). No other changes;onGridMovealready early-returns when either ref is null.