Skip to content

Agentic UI: Point Reload and Toggle DevTools at the app window instead of the focused webview - #4442

Open
shaunandrews wants to merge 1 commit into
trunkfrom
fix-app-window-reload-target
Open

Agentic UI: Point Reload and Toggle DevTools at the app window instead of the focused webview#4442
shaunandrews wants to merge 1 commit into
trunkfrom
fix-app-window-reload-target

Conversation

@shaunandrews

Copy link
Copy Markdown
Contributor

Related issues

None (split out of the stu-2162-site-header-actions exploration)

How AI was used in this PR

Claude Code cherry-picked this change out of a larger exploration branch and verified it (lint, typecheck) in isolation.

Proposed Changes

View ▸ Reload / Force Reload / Toggle DevTools used Electron's role-based "focused webContents" target. With a site preview visible, clicking into the preview would shift focus to the guest page, so Reload reloaded the site preview instead of the app — leaving no way to reload the Studio renderer itself from the menu.

These menu items now target the app window's webContents explicitly, and are relabelled "Reload App" / "Force Reload App" to make that explicit. In agentic mode, Reload App drops its ⌘R accelerator so ⌘R still reloads the preview (the renderer's own "Reload preview" shortcut); Force Reload App keeps ⌘⇧R.

Testing Instructions

  1. Launch the app with a site preview visible.
  2. Click into the preview area to give the guest webview focus.
  3. Use View ▸ Reload App and confirm the app renderer reloads (not the site preview/guest page).
  4. In agentic mode, press ⌘R and confirm it still reloads the preview, not the app window.
  5. Use View ▸ Force Reload App and confirm it force-reloads the app renderer (⌘⇧R still works too).
  6. Use View ▸ Toggle DevTools and confirm DevTools opens for the app window, regardless of which webview had focus.

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

…used webview

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@shaunandrews shaunandrews changed the title Point Reload and Toggle DevTools at the app window instead of the focused webview Agentic UI: Point Reload and Toggle DevTools at the app window instead of the focused webview Aug 4, 2026
@shaunandrews
shaunandrews requested a review from Copilot August 4, 2026 19:02

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates the Electron app menu so View ▸ Reload / Force Reload / Toggle DevTools reliably target the Studio app window’s renderer webContents (instead of whichever webContents is focused, such as a site preview webview), and clarifies this behavior via relabeling and accelerator tweaks for agentic mode.

Changes:

  • Adds a helper to run actions against the main app window’s webContents.
  • Replaces role-based reload/devtools menu items with explicit webContents actions to avoid focus-dependent behavior.
  • Renames menu items to “Reload App” / “Force Reload App” and adjusts the Reload App accelerator in agentic mode to preserve the preview’s ⌘R behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread apps/studio/src/menu.ts
// Runs against the app window's own contents rather than whatever has focus.
async function withAppWebContents( run: ( contents: WebContents ) => void ) {
const window = await getMainWindow();
if ( window && ! window.webContents.isDestroyed() ) {
@shaunandrews
shaunandrews requested review from a team and bcotrim August 4, 2026 19:16
@shaunandrews
shaunandrews marked this pull request as ready for review August 4, 2026 19:16
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.

2 participants