Split VideoGen.jsx into hooks + subcomponents#2861
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Decomposes the ~1990-line
client/src/pages/VideoGen.jsxgod-component (issue #2834) into focused modules while preserving behavior and the URL/deep-link contract exactly.client/src/hooks/useVideoGenQueue.js. The page passes{ generating, runGeneration }and gets back{ queue, enqueue, removeFromQueue, clearFinishedQueue, cancelRunning }.runGenerationis 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.videoModelMemoryGb,computeFflfSafeFrames(FFLF/ltx2 pixel-budget back-solve, mirrorsserver/services/videoGen/local.js),isModelAllowedForMode, and theFRAME_OPTIONS/FPS_OPTIONS/VIDEO_EDGE_BOUNDSconstants move toclient/src/lib/videoGenParams.js(per CLAUDE.md: side-effect-free helpers live inlib/, nothooks/). Added with unit tests.client/src/components/videoGen/:RuntimeFingerprint,ModelRepairBanner(deduped — one component now serves both the model and text-encoder integrity banners),VideoPreviewPanel, andVideoGenGallery(recent + hidden sections).fetch('/api/...')boundary leak at the oldVideoGen.jsx:876runtime-status probe now routes through a newgetVideoGenRuntimeStatus(runtime, { signal })wrapper inclient/src/services/apiImageVideo.js(silent, honors the AbortController signal — same swallow-on-failure behavior).<input>gains a proper<label htmlFor="video-seed">/idpairing.New public modules are registered in the
client/src/libandclient/src/hooksbarrels + README catalogs (enforced byindex.test.js). Net −396 lines from the page.Test plan
clientESLint clean on all touched files.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.cd client && npm testsuite: 4554 passing; the single failure (StoryBuilder.test.jsxanalyzeImport providerOverride) is a pre-existing order-dependent flake — passes in isolation and is unrelated to this change.vite buildsucceeds.Closes #2834