Skip to content

Move recent projects into the desktop File menu - #72

Merged
wassgha merged 2 commits into
mainfrom
recents
Aug 6, 2026
Merged

wassgha merged 2 commits into
mainfrom
recents

Conversation

@wassgha

@wassgha wassgha commented Aug 6, 2026 •

Copy link
Copy Markdown
Owner

On desktop, the upload screen's in-page "Recent" list duplicated what a native app puts in File › Recent Projects. This hides that list under Electron and builds the real menu instead.

File menu

  • Open Project… (⌘O) — opens the media picker from anywhere, including mid-edit.
  • Reopen Last Project (⇧⌘O) — disabled when nothing is saved.
  • Recent Projects › — up to 10 entries, plus Clear Recent Projects (confirmed, since it deletes the saved edits).

Replacing the menu drops Electron's default one wholesale, so electron/menu.ts restates the standard App/Edit/View/Window items alongside File.

How the list gets there

The projects live in the renderer's IndexedDB, which the main process can't read. The renderer publishes an (id, name) snapshot on mount, on project/status change and on window focus; the menu sends commands back over menu:command.

Commands no longer require a live window:

  • dispatchMenuCommand uses the focused window, else any window, else creates one — the menu bar outlives the last window on macOS.
  • A just-created renderer isn't subscribed yet, so commands queue per-webContents until preload sends menu:renderer-ready, then flush. A cross-document navigation clears readiness so a reload re-announces.
  • open-project is additionally held renderer-side until the page is cross-origin isolated, otherwise a menu-opened window would drop it while the media engine was still starting.

Open Project… is the exception. Chromium only shows a file chooser under user activation, which an IPC message doesn't carry — the first cut silently did nothing. The main process calls window.rescriptOpenFilePicker through executeJavaScript(code, /* userGesture */ true) instead, which grants the activation. A file chosen before isolation settles waits rather than failing in the pipeline.

Closing the window in the editor

Closing while a project is open now returns to the upload screen rather than closing: win.on("close") cancels only when the window is in expanded mode and the renderer is responsive, sends close-project, and the renderer flushes the debounced autosave before reset(). The next close — now on the upload screen — is a real close. ⌘Q still quits (guarded by a quitting flag on before-quit).

Note: on Windows/Linux this also means closing from the editor keeps the app alive on the upload screen and takes a second close. Easy to make that platform close outright if preferred.

Testing

  • tsc --noEmit (app + electron), eslint and npm run build:electron clean.
  • Ran npm run electron:dev: recent list gone from the upload screen; menu entries populate, open and reopen projects.

🤖 Generated with Claude Code

On the desktop the upload screen's recent list duplicated what a native app
puts in File › Recent Projects, so drop it there and build the real menu
instead: Open Project…, Reopen Last Project and a Recent Projects submenu.

The list lives in the renderer's IndexedDB, which the main process can't read,
so the renderer publishes an (id, name) snapshot whenever it can have changed
and the menu sends commands back. Commands wait for a window: the menu bar
outlives the last window on macOS, so a click opens one and the command queues
until the renderer announces it is listening, then until the page is
cross-origin isolated and can actually take media.

Closing the window while a project is open now returns to the upload screen
instead of quitting — the autosave is flushed first, and the next close (on
the upload screen) is a real one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Aug 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
app.rescript Ready Ready Preview Aug 6, 2026 3:34am

Chromium only shows a file chooser under user activation, and an IPC message
doesn't carry one — the input.click() the menu triggered was dropped without a
word. The main process now calls window.rescriptOpenFilePicker via
executeJavaScript with userGesture, which grants the activation, so opening the
picker leaves the command channel entirely.

A file chosen before the page is cross-origin isolated waits until it is rather
than failing in the pipeline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@wassgha
wassgha merged commit 3bf59fb into main Aug 6, 2026
3 checks passed

This branch was successfully deployed

1 active deployment
Preview — 71d41686 Deployed Aug 6, 2026 by vercel[bot]
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