fix: resolve Sentry errors BD, BE, 9E#323
Merged
Merged
Conversation
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
4918283 to
eff414b
Compare
Aymericr
pushed a commit
that referenced
this pull request
Jun 3, 2026
Adds the missing `if (!cursorGroupRef.current) return` guard to onShelfMove. mitt listeners are registered for the tool's whole lifetime, so a shelf event can fire before the cursor group mounts or after teardown, leaving the ref null and throwing on `cursorGroupRef.current.rotation.y`. Partial fix for the EDITOR-BC family: the other placement handlers (onGridMove/onWallMove/onItemMove/onCeilingMove and the keyboard/cancel paths) share the same null-ref exposure and still need the broader, correctly-scoped guard — tracked separately (PR #323 attempts this but needs rework).
Guard every cursorGroupRef.current dereference against the null window where mitt listeners are live but the <group> is unmounted (mount/teardown race) — the EDITOR-BC/BD family. getContext() falls back to the draft's rotation so the validation/revalidate path (Shift keys, onKeyUp) is safe; only the cursor writes are guarded, so cancel, Shift reset, leave-state cleanup and transition state still run unconditionally. Also guards wallPreviewRef in WallTool.stopDrafting() (the double-click/cancel path). Reimplements #323 against current main without its over-broad handler guards that silently dropped Escape-cancel and Shift state. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
eff414b to
353fc0a
Compare
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 errors where
cursorGroupRef.currentandwallPreviewRef.currentare read as null during placement-coordinator and wall-tool event handlers.Sentry impact (live as of 2026-05-27 04:00 UTC nightly triage):
MONOREPO-EDITOR-BC—Cannot read properties of null (reading 'rotation')— 53,478 events since 2026-05-20MONOREPO-EDITOR-BD— same family — 403 events since 2026-05-20MONOREPO-EDITOR-BE—Cannot set properties of null (setting 'visible')in wall-tool — handled by thewall/tool.tsxhunkMONOREPO-EDITOR-9E— same familyRoot cause. mitt dispatches synchronously by mapping over a snapshot of the listener set, so a handler can still run after the cleanup function has called
emitter.off(...)if the emit is already in flight. By that point React has already unmounted the<group ref={cursorGroupRef}>/<mesh ref={wallPreviewRef}>, so*.currentisnulland any.rotation/.visiblewrite throws.Fix. Defensive
if (!ref.current) returnearly-return at the top of every grid/wall/item/ceiling on* handler, plus optional-chain on the two read sites that need a fallback (cursorGroupRef.current?.rotation.y ?? 0).Two files, +31 / -6 lines:
packages/editor/src/components/tools/item/use-placement-coordinator.tsxpackages/nodes/src/wall/tool.tsxRebased onto current
main2026-05-27 04:30 UTC;wall/tool.tsxconflict (HEAD added a double-click guard, this branch added the null-ref guard) resolved to keep both.bun run checkclean on the touched files.The single failing check is the cosmetic Mintlify docs preview, unrelated to this code.
🤖 Authored by Anton (Pascal AI assistant). Diagnosis written up in
memory/sentry-triage/2026-05-27.md.