refactor(editor): extract export status model#566
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA new ChangesExport Status Model Extraction
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/video-editor/exportStatusModel.ts`:
- Around line 38-48: exportFinalizingProgress currently only upper-clamps and
doesn't guard against NaN/negative/infinite values; update the computation in
the exportFinalizingProgress/exportFinalizingPercent logic (referencing
exportFinalizingProgress, exportFinalizingPercent,
exportProgress.renderProgress, exportProgress.percentage, isExportFinalizing) to
first derive a numeric rawProgress (use renderProgress if typeof number else
exportProgress?.percentage ?? 100), then sanitize by treating non-finite values
as 0 and clamping with Math.max(0, Math.min(100, rawProgress)), and finally
compute exportFinalizingPercent by rounding that sanitized/clamped value; ensure
rounding happens after sanitization.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 36113b2d-c354-4b55-ac6e-802a7955ad43
📒 Files selected for processing (3)
src/components/video-editor/VideoEditor.tsxsrc/components/video-editor/exportStatusModel.test.tssrc/components/video-editor/exportStatusModel.ts
Description
Extracts the export progress/status display model from
VideoEditor.tsxinto a small pure module,exportStatusModel.ts.Motivation
VideoEditor.tsxstill owns several unrelated export responsibilities. This slice keeps reducing that surface area by moving derived export UI state into a testable boundary without touching export execution, native routing, save behavior, or renderer lifecycle.Type of Change
Related Issue(s)
None.
Changes Made
resolveExportStatusModelfor export progress/status derived state.VideoEditor.tsxto consume the model while keeping i18n text composition in the component.Scope Note
This PR does not change export behavior, UX copy, native helper routing, NVIDIA detection, save/finalize behavior, renderer selection, project persistence, or packaged build settings. It is a pure extraction of existing derived UI state.
Testing Guide
Checklist
mainLocal Checks
npm test -- src/components/video-editor/exportStatusModel.test.ts src/components/video-editor/mp4ExportSettings.test.ts src/components/video-editor/mp4ExportRouting.test.ts src/components/video-editor/useNvidiaCudaExportOptIn.test.tsnpx tsc --noEmit --pretty falsenpx biome check --formatter-enabled=false src/components/video-editor/VideoEditor.tsx src/components/video-editor/exportStatusModel.ts src/components/video-editor/exportStatusModel.test.tsgit diff --checkRuntime/Repro Evidence
Not run. This is a pure derived-state extraction with no exporter/native/runtime path changes.
Summary by CodeRabbit
Refactor
Tests