Skip to content

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

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

fix(editor): guard door segment 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

Problem

Sentry issue EDITOR-AM — TypeError: Cannot read properties of undefined (reading 'length') in door-system.tsx (487 events in a 1-hour burst).

In addLeafSegmentContent(), the code accesses seg.columnRatios.length without a null guard. Legacy door nodes in the database may lack the columnRatios field on segments because it was added later to the Zod schema with a default value ([1]). When the viewer loads these nodes directly from the DB (bypassing Zod parse), the field is undefined.

Fix

  • Added defensive fallback: seg.columnRatios ?? [1] (matches Zod default)
  • Added defensive fallback: seg.dividerThickness ?? 0.03 (matches Zod default)
  • Extracted both into local const variables used throughout the loop for consistency

Verification

  • tsc --build passes cleanly
  • No runtime behavior change for nodes that already have these fields populated

Add defensive null guards for seg.columnRatios and seg.dividerThickness
in addLeafSegmentContent(). Legacy door nodes stored in the database may
lack these fields since they were added later to the Zod schema with
defaults. Without the guard, accessing .length on undefined crashes the
viewer (Sentry EDITOR-AM, 487 events in 1 hour burst).
@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.

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