Skip to content

Split VideoGen.jsx into hooks + subcomponents#2861

Merged
atomantic merged 1 commit into
mainfrom
claim/issue-2834
Jul 22, 2026
Merged

Split VideoGen.jsx into hooks + subcomponents#2861
atomantic merged 1 commit into
mainfrom
claim/issue-2834

Conversation

@atomantic

Copy link
Copy Markdown
Owner

Summary

Decomposes the ~1990-line client/src/pages/VideoGen.jsx god-component (issue #2834) into focused modules while preserving behavior and the URL/deep-link contract exactly.

  • Domain logic → hook. The client-side serial batch-queue orchestration (queue state, running marker, worker effect, BUSY-backoff retry, unmount/staleness guards) moves into client/src/hooks/useVideoGenQueue.js. The page passes { generating, runGeneration } and gets back { queue, enqueue, removeFromQueue, clearFinishedQueue, cancelRunning }. runGeneration is held on a ref inside the hook so the worker effect keeps its original [queue, generating, runningQueueId] deps and never re-dispatches on the page's per-render closure churn.
  • Pure helpers → lib. videoModelMemoryGb, computeFflfSafeFrames (FFLF/ltx2 pixel-budget back-solve, mirrors server/services/videoGen/local.js), isModelAllowedForMode, and the FRAME_OPTIONS/FPS_OPTIONS/VIDEO_EDGE_BOUNDS constants move to client/src/lib/videoGenParams.js (per CLAUDE.md: side-effect-free helpers live in lib/, not hooks/). Added with unit tests.
  • UI → subcomponents under client/src/components/videoGen/: RuntimeFingerprint, ModelRepairBanner (deduped — one component now serves both the model and text-encoder integrity banners), VideoPreviewPanel, and VideoGenGallery (recent + hidden sections).
  • fetch('/api/...') boundary leak at the old VideoGen.jsx:876 runtime-status probe now routes through a new getVideoGenRuntimeStatus(runtime, { signal }) wrapper in client/src/services/apiImageVideo.js (silent, honors the AbortController signal — same swallow-on-failure behavior).
  • Accessibility: the Seed <input> gains a proper <label htmlFor="video-seed">/id pairing.

New public modules are registered in the client/src/lib and client/src/hooks barrels + README catalogs (enforced by index.test.js). Net −396 lines from the page.

Test plan

  • client ESLint clean on all touched files.
  • New client/src/lib/videoGenParams.test.js (13 cases) passes.
  • client/src/lib/index.test.js + client/src/hooks/index.test.js (barrel/README enforcement) pass.
  • client/src/components/videoGen/ existing component tests pass.
  • Full cd client && npm test suite: 4554 passing; the single failure (StoryBuilder.test.jsx analyzeImport providerOverride) is a pre-existing order-dependent flake — passes in isolation and is unrelated to this change.
  • vite build succeeds.

Closes #2834

@atomantic
atomantic merged commit f4b87de into main Jul 22, 2026
2 checks passed
@atomantic
atomantic deleted the claim/issue-2834 branch July 22, 2026 01:04
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.

Split VideoGen.jsx (~1987 lines) into hooks + subcomponents

1 participant