Skip to content

refactor(editor): extract export progress state#568

Merged
meiiie merged 1 commit into
mainfrom
refactor/editor-export-progress-state
May 22, 2026
Merged

refactor(editor): extract export progress state#568
meiiie merged 1 commit into
mainfrom
refactor/editor-export-progress-state

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 22, 2026

Description

Extracts the export saving-progress state transition from VideoEditor.tsx into a small pure module, exportProgressState.ts.

Motivation

VideoEditor.tsx still owns export orchestration and UI state transitions. This slice moves one pure transition out of the component without touching exporter construction, Electron save APIs, native routing, smoke reports, or UI copy.

Type of Change

  • Refactor
  • Tests

Related Issue(s)

None.

Changes Made

  • Added resolveSavingExportProgress for deriving the progress state shown while the save dialog/finalize path is active.
  • Updated markExportAsSaving to call the pure transition through setExportProgress.
  • Added unit tests for preserving runtime diagnostics, existing frame fallback behavior, and the no-previous-progress fallback.

Scope Note

This PR does not change export execution, save/finalize behavior, native/NVIDIA routing, smoke export reports, UI copy, project persistence, or packaged build settings. It only extracts the existing saving-progress state transition into a tested pure function.

Testing Guide

  1. Start an export and reach the save/finalize step.
  2. Confirm the export dropdown still shows the save/saving state as before.
  3. Optional: cancel the save dialog and retry save to confirm pending-save behavior is unchanged.

Checklist

  • Focused branch from latest main
  • Small architecture slice only
  • Added focused tests
  • Typecheck passes
  • Scoped Biome passes
  • No runtime/export behavior intentionally changed

Local Checks

  • npm test -- src/components/video-editor/exportProgressState.test.ts src/components/video-editor/exportStatusModel.test.ts src/components/video-editor/exportStartSettings.test.ts
  • npm test -- src/components/video-editor/exportProgressState.test.ts src/components/video-editor/exportStartSettings.test.ts 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.ts
  • npx tsc --noEmit --pretty false
  • npx biome check --formatter-enabled=false src/components/video-editor/VideoEditor.tsx src/components/video-editor/exportProgressState.ts src/components/video-editor/exportProgressState.test.ts
  • npx biome check --formatter-enabled=false src/components/video-editor/VideoEditor.tsx src/components/video-editor/exportProgressState.ts src/components/video-editor/exportProgressState.test.ts src/components/video-editor/exportStartSettings.ts src/components/video-editor/exportStatusModel.ts src/components/video-editor/mp4ExportSettings.ts src/components/video-editor/mp4ExportRouting.ts src/components/video-editor/useNvidiaCudaExportOptIn.ts
  • git diff --check

Runtime/Repro Evidence

Not run. This is a pure progress-state extraction with no exporter/native/save path changes.

Summary by CodeRabbit

  • Refactor

    • Improved export progress state handling during the video saving phase.
  • Tests

    • Added test coverage for export progress saving functionality to ensure accurate frame tracking and completion metrics.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 22, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 956da3c0-ca63-4348-858e-91a39ec7df97

📥 Commits

Reviewing files that changed from the base of the PR and between 18e93f7 and f778010.

📒 Files selected for processing (3)
  • src/components/video-editor/VideoEditor.tsx
  • src/components/video-editor/exportProgressState.test.ts
  • src/components/video-editor/exportProgressState.ts

📝 Walkthrough

Walkthrough

This PR extracts inline export-progress construction into a reusable helper function. A new resolveSavingExportProgress function is added to centralize the logic for transitioning to the "saving" phase while preserving backend diagnostics. VideoEditor is updated to call this helper instead of building the object inline.

Changes

Export saving progress helper extraction

Layer / File(s) Summary
Helper function definition and tests
src/components/video-editor/exportProgressState.ts, src/components/video-editor/exportProgressState.test.ts
New resolveSavingExportProgress helper constructs an ExportProgress object for the "saving" phase, preserving backend metadata and frame counts from prior progress, defaulting to 1 frame when unavailable, and marking completion at 100% with zero remaining time. Test suite verifies normal progress transition, zero-frame edge case, and null-input fallback with minimal initialization.
VideoEditor integration
src/components/video-editor/VideoEditor.tsx
VideoEditor imports the new helper and calls resolveSavingExportProgress in markExportAsSaving instead of manually constructing the progress object inline.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

  • webadderallorg/Recordly#566: Both PRs modify VideoEditor.tsx's export-phase/saving handling—this PR replaces inline "enter saving" exportProgress construction via resolveSavingExportProgress, while the other refactors export status derivation into resolveExportStatusModel, covering saving/finalizing state logic.

Suggested labels

Checked

Poem

🐰 A helper hops out, clean and neat,
Saving progress now complete!
No more construction, scattered wide—
One place holds all the logic inside.
Tests guard the path, both new and old. 🎬✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: extracting export progress state logic from VideoEditor.tsx into a dedicated module.
Description check ✅ Passed The description comprehensively covers all template sections including motivation, type of change, testing guide, and scope clarification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/editor-export-progress-state

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

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint skipped: no ESLint configuration detected in root package.json. To enable, add eslint to devDependencies.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@meiiie meiiie merged commit 48b48dc into main May 22, 2026
3 checks passed
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.

1 participant