Fix Studio timeline render crash from circular import#7442
Conversation
Move TIMELINE_INDENT into its own module so Padder and TimelineExpandedRow no longer import from TimelineListItem, breaking a cycle that could leave Padder undefined at runtime and crash the timeline with an invalid element type. Co-authored-by: Cursor <cursoragent@cursor.com>
Revert accidental hook and TimelineExpandedRow changes picked up from the SSE branch base when cherry-picking TimelineListItem. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Note
Minimal, targeted fix. The cycle TimelineListItem → Padder → TimelineListItem is real, and because both Padder and INDENT are export const (non-hoisted), an import path that lands in Padder.tsx first yields a Padder binding of undefined in TimelineListItem.tsx — matching the reported React error. Extracting TIMELINE_INDENT to a leaf module is the right break, and all callers are updated (no dangling INDENT references remain in packages/studio/src).
TL;DR — Breaks the Padder ↔ TimelineListItem import cycle by moving the indent constant into its own leaf module, eliminating the undefined Padder runtime error in Studio's timeline.
Key changes
- Extract
TIMELINE_INDENTtotimeline-indent.ts— New leaf module holds the constant previously exported asINDENTfromTimelineListItem.tsx. - Repoint
PadderandTimelineExpandedRow— Both now import from./timeline-indentinstead of./TimelineListItem, severing the cycle that ran throughPadder.
Summary | 4 files | 2 commits | base: main ← fix/timeline-padder-circular-import
Why the cycle crashed the timeline
Before:
TimelineListItemimportedPadder, andPadderimportedINDENTfromTimelineListItem— when module evaluation entered throughPadder.tsxfirst, thePadderbinding observed byTimelineListItem.tsxwasundefined, producingElement type is invalid ….
After: Both consumers depend on a leaf module that imports nothing, so evaluation order no longer determines whetherPadderis defined whenTimelineListItemreads it.
The fix follows the kebab-case convention already used for non-component modules in this folder (save-sequence-prop.ts, timeline-field-utils.ts, imperative-state.ts).
Padder.tsx · TimelineExpandedRow.tsx · TimelineListItem.tsx · timeline-indent.ts
Claude Opus | 𝕏

Summary
Moves
TIMELINE_INDENTinto a dedicatedtimeline-indent.tsmodule.Updates
PadderandTimelineExpandedRowto import from that module instead ofTimelineListItem.Breaks a circular import (
Padder↔TimelineListItem) that could leavePadderasundefinedat runtime, causing React to throw:This is independent of the Studio
/eventsSSE consolidation work in #7432.Test plan
Made with Cursor