Skip to content

fix(editor): guard door segments and columnRatios against undefined#303

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

fix(editor): guard door segments and columnRatios against undefined#303
anton-pascal wants to merge 1 commit into
mainfrom
fix/sentry-EDITOR-AM

Conversation

@anton-pascal
Copy link
Copy Markdown
Contributor

@anton-pascal anton-pascal commented May 12, 2026

Problem

Sentry issue EDITOR-AM — TypeError: Cannot read properties of undefined (reading 'length') in door-system.tsx (487 events) AND escalating issue Cannot read properties of undefined (reading 'some') (1.8k events).

In door-system.tsx, the code accesses segments.some and seg.columnRatios.length without null guards. Legacy door nodes in the database may lack these fields because they were added later to the Zod schema with a default value. When the viewer loads these nodes directly from the DB, the fields are undefined.

Fix

  • Added defensive fallback: segments ?? [] for all array iterations.
  • Added defensive fallback: seg.columnRatios ?? [1] (matches Zod default).
  • Added defensive fallback: seg.dividerThickness ?? 0.03 (matches Zod default).

@mintlify
Copy link
Copy Markdown

mintlify Bot commented May 12, 2026

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

Project Status Preview Updated (UTC)
pascal 🔴 Failed May 12, 2026, 4:06 AM

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

Add defensive null guards for segments, seg.columnRatios, and seg.dividerThickness in door-system.tsx. Legacy door nodes stored in the database may lack these fields since they were added later to the schema. Without the guard, accessing .length or .some() on undefined crashes the viewer (Sentry EDITOR-AM and escalating 1.8k events).
@anton-pascal anton-pascal force-pushed the fix/sentry-EDITOR-AM branch from 1e3e602 to bd789e0 Compare May 18, 2026 10:06
@anton-pascal anton-pascal changed the title fix(editor): guard door segment columnRatios against undefined fix(editor): guard door segments and columnRatios against undefined May 18, 2026
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