Skip to content

feat: remember last export folder across sessions#516

Closed
makaradam wants to merge 2 commits intosiddharthvaddem:mainfrom
makaradam:main
Closed

feat: remember last export folder across sessions#516
makaradam wants to merge 2 commits intosiddharthvaddem:mainfrom
makaradam:main

Conversation

@makaradam
Copy link
Copy Markdown

@makaradam makaradam commented May 1, 2026

The save dialog now opens in the last folder the user exported to, instead of always defaulting to Downloads. The folder is persisted in userPreferences (localStorage) and passed through the IPC layer to the Electron save dialog as defaultPath.

Closes #503

What

The export save dialog now opens in the last folder the user chose,
instead of always defaulting to the Downloads directory.

How

  • Added exportFolder?: string to UserPreferences — persisted in localStorage
  • The saved folder is passed from the renderer to the Electron save-exported-video
    IPC handler as defaultPath
  • On every successful export (MP4, GIF, or re-save of a canceled export),
    the chosen folder is extracted from the result path and saved back to preferences

Type of Change

  • New Feature
  • [ X] Bug Fix
  • Refactor / Code Cleanup
  • Documentation Update
  • Other (please specify)

Related Issue(s)

#503

Tested, and works

Summary by CodeRabbit

  • New Features
    • Users can now choose a custom export folder when saving video exports; the choice is used as the default for subsequent exports (including GIF/MP4/unsaved exports) and is persisted in preferences.
    • Save results now include the output directory so the app can update and remember the selected folder.

The save dialog now opens in the last folder the user exported to,
instead of always defaulting to Downloads. The folder is persisted
in userPreferences (localStorage) and passed through the IPC layer
to the Electron save dialog as defaultPath.

Closes siddharthvaddem#503
@makaradam makaradam requested a review from siddharthvaddem as a code owner May 1, 2026 23:04
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 1, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3ce4f3b5-972c-40ad-a22a-fe2044a54a8d

📥 Commits

Reviewing files that changed from the base of the PR and between 84952f3 and 7b2fe8a.

📒 Files selected for processing (3)
  • electron/electron-env.d.ts
  • electron/ipc/handlers.ts
  • src/components/video-editor/VideoEditor.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • electron/ipc/handlers.ts
  • src/components/video-editor/VideoEditor.tsx

📝 Walkthrough

Walkthrough

Adds a persistent "last export folder" flow: API, IPC handler, and preload now accept an optional exportFolder; the handler uses it as the save dialog defaultPath and returns the chosen dir; user preferences gain exportFolder; VideoEditor persists, loads, and passes exportFolder into save calls.

Changes

Export folder persistence & save flow

Layer / File(s) Summary
Type / API
electron/electron-env.d.ts
saveExportedVideo gains optional exportFolder?: string argument; result Promise now may include dir?: string in addition to existing fields.
IPC Core
electron/ipc/handlers.ts
ipcMain.handle("save-exported-video", async (_, videoData, fileName, exportFolder?) => ...) now uses exportFolder ?? app.getPath("downloads") as dialog defaultPath; on success returns { success: true, path, dir: path.dirname(normalizedPath), message }.
Preload / Bridge
electron/preload.ts
contextBridge.exposeInMainWorld saveExportedVideo forwards optional exportFolder to the "save-exported-video" IPC call.
Preferences Model
src/lib/userPreferences.ts
UserPreferences adds optional exportFolder?: string; loader accepts only non-empty string values from storage.
UI Wiring
src/components/video-editor/VideoEditor.tsx
Adds exportFolder state, hydrates from preferences, auto-saves it, passes it into all saveExportedVideo calls, and updates state from returned dir when present; relevant hook deps updated.
Package / Manifests
package.json
minor manifest updates referenced in diffs.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

a little path remembered, tucked in prefs so kind
next export opens where you left off—no wander, peace of mind
lowkey convenient, kinda cursed to be so fine ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main feature: remembering the last export folder across sessions, which matches the primary objective.
Description check ✅ Passed The description covers the what, how, and includes a linked issue. However, it's missing the full PR template structure with screenshots, testing instructions, and a complete checklist.
Linked Issues check ✅ Passed The PR fully implements the feature requested in #503: it captures the last export folder in localStorage, passes it as defaultPath to the save dialog, and updates preferences on successful export.
Out of Scope Changes check ✅ Passed All changes are scoped to implementing the folder persistence feature. No unrelated modifications detected across the five modified files.

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


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
Review rate limit: 7/8 reviews remaining, refill in 7 minutes and 30 seconds.

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

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 84952f3091

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread src/components/video-editor/VideoEditor.tsx Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 1319-1323: The current renderer code slices saveResult.path to
compute a folder which can produce empty strings for root saves; instead modify
the IPC/save handler to return a proper dirname (use path.normalize +
path.dirname) and update the renderer to call setExportFolder with that returned
dirname (replace the substring logic around saveResult.path and references in
setExportFolder at the blocks near lines handling saveResult.path and the other
occurrences around 1431-1435 and 1580-1584). Ensure the IPC payload contains a
field like exportFolder (computed in the main process) and change the renderer
to use saveResult.exportFolder directly rather than re-parsing paths.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 05baedd0-2e5d-4568-a2f3-4b853d04ee64

📥 Commits

Reviewing files that changed from the base of the PR and between 884021c and 84952f3.

📒 Files selected for processing (5)
  • electron/electron-env.d.ts
  • electron/ipc/handlers.ts
  • electron/preload.ts
  • src/components/video-editor/VideoEditor.tsx
  • src/lib/userPreferences.ts

Comment thread src/components/video-editor/VideoEditor.tsx Outdated
Addresses code review feedback: the previous substring/lastIndexOf approach
would store empty string as export folder if saved to root directory.
path.dirname in the Electron handler handles edge cases correctly and
is returned as a new dir field in the IPC response.
@makaradam
Copy link
Copy Markdown
Author

@makaradam makaradam closed this May 2, 2026
@Qodo-Free-For-OSS
Copy link
Copy Markdown

Hi, Window.electronAPI.saveExportedVideo’s declared return type omits error?: string, but the IPC handler returns an error field on failures. This prevents typed renderer code from accessing detailed failure information without type assertions.

Severity: remediation recommended | Category: correctness

How to fix: Add error to return type

Agent prompt to fix - you can give this to your LLM of choice:

Issue description

The TypeScript declaration for window.electronAPI.saveExportedVideo does not include an error field, but the IPC handler returns it on failure.

Issue Context

Keeping env.d.ts aligned with actual IPC return shapes improves typed error handling and avoids needing type assertions.

Fix Focus Areas

  • electron/electron-env.d.ts[76-86]
  • electron/ipc/handlers.ts[869-875]

Suggested change

  • Add error?: string; to the return type in electron/electron-env.d.ts for saveExportedVideo.

Spotted by Qodo code review - free for open-source projects.

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.

[Feature]: remember last exporting folder

2 participants