refactor(editor): extract project dirty state#545
Conversation
📝 WalkthroughWalkthroughThe PR extracts deep-equality logic from VideoEditor into a new ChangesProject dirty-state utility extraction
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
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 Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the 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 |
…ct-dirty-state-local # Conflicts: # src/components/video-editor/VideoEditor.tsx
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/components/video-editor/VideoEditor.tsx (1)
2293-2298:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAvoid logging raw filesystem paths from recording sessions.
Line 2297 logs
session?.webcamPath, which can expose user-identifying local paths in app logs. Prefer logging presence/absence instead of the full path.🔧 Suggested fix
console.log("[VideoEditor] onRecordingSessionChanged received!", { sessionVideoPath: session?.videoPath, videoSourcePath: videoSourcePath, match: session?.videoPath === videoSourcePath, - webcamPath: session?.webcamPath, + hasWebcamPath: Boolean(session?.webcamPath), });🤖 Prompt for 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. In `@src/components/video-editor/VideoEditor.tsx` around lines 2293 - 2298, The console.log in the onRecordingSessionChanged handler is currently emitting raw filesystem paths (session?.webcamPath, session?.videoPath, videoSourcePath); change the log to avoid exposing full paths by replacing those fields with safe indicators (e.g., booleans like hasWebcam: Boolean(session?.webcamPath), hasVideo: Boolean(session?.videoPath), isMatch: session?.videoPath === videoSourcePath) or masked values before calling console.log so only presence/match info is recorded, keeping the existing message context.
🤖 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.
Outside diff comments:
In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 2293-2298: The console.log in the onRecordingSessionChanged
handler is currently emitting raw filesystem paths (session?.webcamPath,
session?.videoPath, videoSourcePath); change the log to avoid exposing full
paths by replacing those fields with safe indicators (e.g., booleans like
hasWebcam: Boolean(session?.webcamPath), hasVideo: Boolean(session?.videoPath),
isMatch: session?.videoPath === videoSourcePath) or masked values before calling
console.log so only presence/match info is recorded, keeping the existing
message context.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: e1095699-dcdc-4770-844f-c59c186c10ef
📒 Files selected for processing (1)
src/components/video-editor/VideoEditor.tsx
Description
Extracts the unsaved-project dirty-state comparison out of
VideoEditor.tsxinto a small pure module with focused coverage.Motivation
This continues the editor architecture refactor by moving another self-contained state decision out of the god component. The slice is intentionally stacked on
#544because it builds on the editor history model branch and should be reviewed after that PR.Type of Change
Related Issue(s)
Stacked after #544.
Changes Made
src/components/video-editor/projectDirtyState.tswithhasUnsavedProjectChanges.VideoEditor.tsxto delegatehasUnsavedChangesto the extracted dirty-state model.Scope Note
No UI behavior, persistence format, project save/load behavior, export behavior, native helper behavior, or runtime path is intentionally changed. This PR is a stacked draft PR based on
refactor/editor-history-model-slice; it should not be merged before #544.Testing Guide
Review only the diff against #544:
projectDirtyState.ts, its test, and the smallVideoEditor.tsxcall-site replacement.Checklist
Local Checks
npm test -- src/components/video-editor/projectDirtyState.test.ts(5 tests passed)npm test -- src/components/video-editor/projectDirtyState.test.ts src/components/video-editor/editorHistory.test.ts src/components/video-editor/types.test.ts(30 tests passed)npx tsc --noEmit --pretty false(passed)npx biome check --formatter-enabled=false --assist-enabled=false src/components/video-editor/VideoEditor.tsx src/components/video-editor/projectDirtyState.ts src/components/video-editor/projectDirtyState.test.ts(exit 0; existing unrelatedVideoEditor.tsxexhaustive-deps warning remains)git diff --check refactor/editor-history-model-slice...HEAD(passed)Runtime/Repro Evidence
Not run. This PR moves pure project dirty-state comparison into a tested module; no Electron, preview rendering, export, or native runtime path changed.
Summary by CodeRabbit
Refactor
Tests