Skip to content

refactor(studio): code quality — 22 findings, dead code removal, App.tsx split#144

Merged
miguel-heygen merged 8 commits intomainfrom
feat/studio-code-quality
Mar 31, 2026
Merged

refactor(studio): code quality — 22 findings, dead code removal, App.tsx split#144
miguel-heygen merged 8 commits intomainfrom
feat/studio-code-quality

Conversation

@miguel-heygen
Copy link
Copy Markdown
Collaborator

@miguel-heygen miguel-heygen commented Mar 30, 2026

Summary

Full code quality review of the studio package, fixing 22 of 25 findings. Removes dead code, extracts modules from App.tsx, fixes accessibility and performance issues.

Critical fixes (3)

  • aria-valuenow on seek bar now updates imperatively via liveTime.subscribe — screen readers previously always reported position 0
  • Speed menu closes on outside click (was permanently stuck open)
  • RenderQueue auto-scroll moved from render phase to useEffect (was violating React render purity via queueMicrotask during render)

Dead code removed (-331 lines)

File Lines Why dead
PreviewPanel.tsx 180 Replaced by NLELayout + NLEPreview
useCodeEditor.ts 80 Exported but never imported
formatTick alias 2 Deprecated, unused
onClipChange prop 5 Declared, never used
trackH prop 5 Declared, never used
editRange* + updaters in store 60 Never read or written

App.tsx extraction

Extracted to Lines What
components/LintModal.tsx 130 Lint results modal + LintFinding type
components/MediaPreview.tsx 75 Image/video/audio/font file previewer
utils/mediaTypes.ts 15 Shared regex constants (App.tsx and AssetsTab.tsx had diverged copies)

Performance fixes

  • useMemo for compositions/assets derivation from fileTree
  • useMemo for buildTree(files) in FileTree
  • Debounced handleContentChange PUT (600ms — was firing on every keystroke)
  • CompositionsTab iframe hover debounced (300ms — was mounting immediately)
  • VideoFrameThumbnail re-extracts frame when src prop changes

Not addressed (3 — low priority)

🤖 Generated with Claude Code

@miguel-heygen miguel-heygen force-pushed the feat/studio-renders-timeline branch from da7fc7c to 62da835 Compare March 30, 2026 23:13
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 10c54a4 to 88c7ac9 Compare March 30, 2026 23:13
@miguel-heygen miguel-heygen force-pushed the feat/studio-renders-timeline branch from 62da835 to 18f68dc Compare March 30, 2026 23:20
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 88c7ac9 to 603dda8 Compare March 30, 2026 23:20
@miguel-heygen miguel-heygen changed the title refactor(studio): code quality — 22 findings fixed, dead code removed, App.tsx split refactor(studio): code quality — 22 findings, dead code removal, App.tsx split Mar 30, 2026
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch 2 times, most recently from bff4940 to 5510cfd Compare March 31, 2026 00:50
@miguel-heygen miguel-heygen force-pushed the feat/studio-renders-timeline branch from 18f68dc to 0a61067 Compare March 31, 2026 01:52
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 9ecd4e6 to 3093cc4 Compare March 31, 2026 01:53
@miguel-heygen miguel-heygen force-pushed the feat/studio-renders-timeline branch 2 times, most recently from 6a7d8e0 to 70874f7 Compare March 31, 2026 01:58
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from 3093cc4 to a1f2631 Compare March 31, 2026 01:58
@miguel-heygen miguel-heygen changed the base branch from feat/studio-renders-timeline to graphite-base/144 March 31, 2026 02:01
miguel-heygen and others added 7 commits March 31, 2026 02:01
Critical:
- PlayerControls: aria-valuenow updates imperatively via liveTime sub
- PlayerControls: speed menu closes on outside click
- RenderQueue: auto-scroll moved from render phase to useEffect

Dead code removed:
- PreviewPanel.tsx (180 lines, replaced by NLELayout)
- useCodeEditor.ts (unused hook)
- formatTick deprecated alias from Timeline.tsx
- onClipChange from TimelineProps (never used)
- trackH prop from TimelineClip (never used)
- editRangeStart/End/Mode + individual updaters from playerStore

Fixes:
- CompositionsTab iframe hover debounced (300ms)
- VideoFrameThumbnail re-extracts when src changes
- playerStore.reset() documents preserved fields
…es from App.tsx

- Extract LintModal (130 lines) to components/LintModal.tsx
- Extract MediaPreview (75 lines) to components/MediaPreview.tsx
- Extract shared media regexes to utils/mediaTypes.ts (single source
  of truth — App.tsx and AssetsTab.tsx were silently diverged)
- Add useMemo for compositions/assets derivation and FileTree buildTree
- Debounce handleContentChange PUT (600ms, was firing every keystroke)
- Guard projectId null in LintModal render
The /api/render/:jobId/view route depended on an in-memory renderJobs
map that's empty after server restart, causing 404s. Replace with a
/api/projects/:id/renders/file/:filename route that reads directly from
the renders directory on disk. Both view and download now use this path.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Match the same #3CE6AC active style used by timeline and renders toggles.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
CompositionThumbnail now takes one screenshot at the midpoint and
stretches it across the clip (object-cover), same approach as After
Effects for precomps. Avoids 6x Puppeteer render cost per composition.

Timeline shift+drag range selection now works even when starting on a
clip — the [data-clip] early return was blocking the shiftKey check.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from a1f2631 to c757f91 Compare March 31, 2026 02:01
@graphite-app graphite-app bot changed the base branch from graphite-base/144 to main March 31, 2026 02:01
Replace all 30 hardcoded [#3CE6AC] and blue-400/blue-500 Tailwind
classes with the studio-accent token defined in tailwind.config.js.
Single source of truth — change the accent in one place.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@miguel-heygen miguel-heygen force-pushed the feat/studio-code-quality branch from c757f91 to 5e8927f Compare March 31, 2026 02:02
@miguel-heygen miguel-heygen merged commit dac304e into main Mar 31, 2026
23 checks passed
Copy link
Copy Markdown
Collaborator Author

Merge activity

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.

2 participants