Skip to content

fix(browser): keep compact viewport stable - #581

Merged
milind-soni merged 1 commit into
mainfrom
codex/fix-browser-viewport-stability
Aug 30, 2026
Merged

fix(browser): keep compact viewport stable#581
milind-soni merged 1 commit into
mainfrom
codex/fix-browser-viewport-stability

Conversation

@milind-soni

@milind-soni milind-soni commented Aug 30, 2026

Copy link
Copy Markdown
Owner

What changed

  • avoid resetting WebContentsView bounds and visibility when layout is unchanged
  • apply compact device emulation only when its effective scale changes
  • ignore identical browser-surface snapshots in the React panel
  • add regressions for repeated layout events, movement, and real size changes

Validation

  • 75 browser-related tests pass
  • TypeScript typecheck passes
  • production build passes

Summary by CodeRabbit

  • Performance Improvements

    • Reduced unnecessary browser view updates when layout, visibility, or emulation settings remain unchanged.
    • Preserved browser view state when views are hidden or repositioned.
    • Prevented redundant interface state updates when no values have changed.
  • Tests

    • Added coverage for repeated layouts, view movement, visibility changes, and compact-mode scaling updates.

@vercel

vercel Bot commented Aug 30, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
openmausbot-docs Ready Ready Preview Aug 30, 2026 9:16am

Request Review

@coderabbitai

coderabbitai Bot commented Aug 30, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 801cdf82-9010-4d82-a9a1-432e1310c5f2

📥 Commits

Reviewing files that changed from the base of the PR and between 9464483 and ed9f604.

📒 Files selected for processing (3)
  • electron/browser-surface.cjs
  • electron/browser-surface.test.mjs
  • src/components/BrowserPanel.tsx

Included review availability: Your plan provides up to 4 included reviews per hour; 1 remains after this review.


📝 Walkthrough

Walkthrough

The Electron browser surface now avoids redundant bounds, visibility, and emulation updates. BrowserPanel also ignores identical surface-state snapshots to prevent unnecessary React state changes and re-renders. Tests verify unchanged layouts, moved views, and compact-scale changes.

Changes

Surface update deduplication

Layer / File(s) Summary
Electron surface update caching
electron/browser-surface.cjs, electron/browser-surface.test.mjs
The surface compares bounds, caches compact and expanded emulation state, bounds compact scale, and applies bounds or visibility only when values change. Tests record view calls and verify repeated layouts, moved views, and scale changes.
React surface state deduplication
src/components/BrowserPanel.tsx
BrowserPanel compares incoming BrowserSurfaceState values and preserves the existing state reference when all fields match. Layout and state subscription handlers use this comparison.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to ed9f6

The PR stabilizes browser layout and panel updates without changing public boundaries or security behavior. No actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description explains the main changes and reports validation results, but it omits the required Why, Screenshots, and Checklist sections. It also uses Validation instead of the required How it was… Add the required Why, How it was verified, Screenshots, and Checklist sections. Rename Validation to How it was verified or provide that heading separately. List the exact commands and platforms used, mark Screenshots as not applicable if n…
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the browser fix and its main effect: keeping the compact viewport stable.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description explains the main changes and reports validation results, but it omits the required Why, Screenshots, and Checklist sections. It also uses Validation instead of the required How it was verified heading and does not list commands or platforms tested.

Resolution

Add the required Why, How it was verified, Screenshots, and Checklist sections. Rename Validation to How it was verified or provide that heading separately. List the exact commands and platforms used, mark Screenshots as not applicable if no UI screenshots are needed, and complete each checklist item.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/fix-browser-viewport-stability

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

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

@milind-soni
milind-soni merged commit 81f2846 into main Aug 30, 2026
9 checks passed
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