Skip to content

fix: preserve window bounds on reload to prevent resize on Windows#1511

Open
Aditya2073 wants to merge 1 commit into
responsively-org:mainfrom
Aditya2073:fix-999-window-resize-on-refresh
Open

fix: preserve window bounds on reload to prevent resize on Windows#1511
Aditya2073 wants to merge 1 commit into
responsively-org:mainfrom
Aditya2073:fix-999-window-resize-on-refresh

Conversation

@Aditya2073

@Aditya2073 Aditya2073 commented Jun 22, 2026

Copy link
Copy Markdown

Description

When the app window is snapped to half screen using Windows Snap and Ctrl+R is pressed (or View → Reload is used), the Electron window loses its snapped position and resizes to full width. This is caused by a known Electron bug (#25359).

Fix

Save the window bounds (position and size) before calling webContents.reload(), then restore them when the page finishes loading via the did-finish-load event.

Changes

  • desktop-app/src/main/menu/view.ts: In the dev-mode reload handler, save mainWindow.getBounds() before reload and restore them via mainWindow.setBounds() after did-finish-load fires.

Testing

  • Build passes: yarn build
  • All tests pass: yarn test (69 tests, 14 files)

Notes

  • This fix applies to the dev-mode reload path (webContents.reload()). In production mode, the reload sends an IPC message to reload individual webview tags, which does not reload the BrowserWindow and should not trigger this issue.
  • The fix only runs when isDev is true, so it has no impact on production behavior.

Fixes #999

When the app window is snapped to half screen (Windows Snap) and Ctrl+R
is pressed in dev mode, webContents.reload() causes the Electron window
to lose its snapped position and resize to full width. This is a known
Electron bug (#25359).

Fix: save window bounds before reloading and restore them when the page
finishes loading.

Fixes responsively-org#999

Co-Authored-By: Claude <noreply@anthropic.com>
@CLAassistant

CLAassistant commented Jun 22, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

Program window go width 100% when refreshing page

2 participants