fix(editor): guard onShelfMove against null cursorGroupRef (Sentry EDITOR-BC, 53k+ events)#342
Open
anton-pascal wants to merge 1 commit into
Open
fix(editor): guard onShelfMove against null cursorGroupRef (Sentry EDITOR-BC, 53k+ events)#342anton-pascal wants to merge 1 commit into
anton-pascal wants to merge 1 commit into
Conversation
Every other surface-move handler in use-placement-coordinator (onGridMove, onWallMove, onCeilingMove, onItemMove) already short-circuits when cursorGroupRef.current is null. onShelfMove was missed in PR #323 and went on to throw TypeError: Cannot read properties of null (reading 'rotation') 53,528 times in vercel-production between 2026-05-20 and 2026-05-27, all firing from the mitt event-emitter dispatch loop while a shelf hover stream raced with cursor unmount. The fix is a one-line guard matching the existing pattern; behavior is unchanged when cursorGroupRef is mounted.
|
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.
Summary
Adds the missing
if (!cursorGroupRef.current) returnguard at the top ofonShelfMoveinpackages/editor/src/components/tools/item/use-placement-coordinator.tsx.Sentry signal
MONOREPO-EDITOR-BCTypeError: Cannot read properties of null (reading 'rotation')vercel-productionStack frames:
Root cause
Every other surface-move handler in this file (
onGridMove,onWallMove,onCeilingMove,onItemMove) already short-circuits whencursorGroupRef.currentis null.onShelfMovewritescursorGroupRef.current.position.set(...)andcursorGroupRef.current.rotation.y = ...without that guard, so when a shelf-surface hover stream from the mitt emitter races with cursor unmount (or fires before the<group ref>attaches), the rotation write throws.That gap was missed when #323 added guards to BD/BE/9E.
Why it's high-confidence
onShelfMoveinto line with them.cursorGroupRef.currentis non-null in normal interaction; the early return only fires during unmount/teardown races, which is exactly when the throw was happening.Followups (separate)
use-placement-coordinator.tsxlines that are the guarded handlers in fix: resolve Sentry errors BD, BE, 9E #323. Worth re-checking after this lands and fix: resolve Sentry errors BD, BE, 9E #323 lands; the 2,830 + 378 events may largely come from the same shelf path or a tiny remaining gap./api/mcpZodError, ~348 events) is unrelated, blocked on schema migration.🤖 Detected and fixed by the nightly Sentry triage agent. Aymeric — never auto-merging.