Skip to content

fix(presets): preserve crop region#614

Merged
meiiie merged 1 commit into
mainfrom
fix/presets-crop-region
May 28, 2026
Merged

fix(presets): preserve crop region#614
meiiie merged 1 commit into
mainfrom
fix/presets-crop-region

Conversation

@meiiie
Copy link
Copy Markdown
Collaborator

@meiiie meiiie commented May 28, 2026

Summary

  • Persist crop region in editor preset snapshots.
  • Restore crop region when applying a saved editor preset.
  • Add regression coverage for crop-region round-tripping.

Why

This addresses the reported regression where saved presets did not save/load crop settings such as Crop Bottom.

Verification

  • npm run test -- src/components/video-editor/editorPreferences.test.ts -t "preserves crop region"
  • npx biome check --formatter-enabled=false src/components/video-editor/editorPreferences.ts src/components/video-editor/editorPreferences.test.ts src/components/video-editor/VideoEditor.tsx
  • npx tsc --noEmit
  • git diff origin/main...HEAD --check

Summary by CodeRabbit

Release Notes

  • New Features

    • Editor presets now save and restore crop region settings when switching between presets.
  • Tests

    • Added tests to verify crop region settings persist correctly across preset operations.

Review Change Stack

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 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: 629b619d-2448-4c32-aca2-92153da1a676

📥 Commits

Reviewing files that changed from the base of the PR and between 4cd02b5 and 970c473.

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

📝 Walkthrough

Walkthrough

This PR extends the editor preset snapshot system to include crop region state. The feature adds cropRegion to the EditorPresetSnapshot type, normalizes it during persistence, and wires it into the VideoEditor component to capture and restore crop region alongside other preset-controlled fields.

Changes

Crop Region Editor Preset Support

Layer / File(s) Summary
Preset Snapshot Type and Normalization
src/components/video-editor/editorPreferences.ts
Introduces PresetCropRegion type alias and extends EditorPresetSnapshot interface with cropRegion field. Updates normalizeEditorPresetSnapshot to normalize and include cropRegion in the returned snapshot object.
Crop Region Persistence and Restore
src/components/video-editor/VideoEditor.tsx
Captures cropRegion into preset snapshots, adds cropRegion to the preset snapshot builder's dependency list for reactive updates, and restores cropRegion from snapshots via setCropRegion.
Test Coverage for Crop Region Persistence
src/components/video-editor/editorPreferences.test.ts
Updates existing saveEditorPresets test snapshots (localStorage and Electron) to include cropRegion: DEFAULT_CROP_REGION. Adds new test verifying that custom snapshot.cropRegion values are preserved through the save/load cycle.

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly Related PRs

  • webadderallorg/Recordly#391: Introduced the editor preset snapshot system that this PR extends with crop region support.
  • webadderallorg/Recordly#523: Added Electron app-settings persistence for presets; this PR extends the persisted preset snapshot structure with cropRegion.
  • webadderallorg/Recordly#394: Introduced cropRegion for webcam overlay with its normalization pipeline via normalizeProjectEditor, which this PR reuses for preset normalization.

Suggested Labels

Checked

Poem

🐰 A crop to save, a crop to restore,
Through presets now, your frames galore!
With snapshots bound and tests that gleam,
The editor's reach extends the dream. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The PR description covers the summary, motivation, and verification steps but does not follow the required template structure with sections like Type of Change, Related Issues, or Screenshots/Testing Guide. Add missing template sections: specify 'Bug Fix' under Type of Change, link related issue(s), and provide a formal Testing Guide section following the template format.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(presets): preserve crop region' is specific, concise, and directly summarizes the main change of persisting and restoring crop region in editor presets.
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 fix/presets-crop-region

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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Actionable comments posted: 0

@meiiie meiiie merged commit 7f7d51c into main May 28, 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