editor
editor copied to clipboard
fix(editor): guard door segments and columnRatios against undefined
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).
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.