Repository navigation
Fix browser WebView refresh on workspace hide - #4388
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Greptile SummaryThis PR makes Browser Memory Saver (WebView discard on workspace hide) opt-in by changing
Confidence Score: 5/5Safe to merge — the change is a one-line default flip in the policy enum, mirrored in the schema, with a targeted regression test and well-guarded updates to existing discard tests. The default flip from opt-out to opt-in is minimal and correct. The new regression test directly exercises the fix path, and the skip guards and withHiddenWebViewDiscardDefaults wrapper keep existing coverage accurate. No production logic paths are altered beyond the default value. No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Workspace hides BrowserPanel] --> B{BrowserHiddenWebViewDiscardPolicy.isEnabled?}
B -- "env var = '1'/'true'/..." --> C[Policy ENABLED]
B -- "env var = '0'/'false'/..." --> D[Policy DISABLED]
B -- "no env var" --> E{UserDefaults key set?}
E -- "yes" --> F{UserDefaults value}
F -- "true" --> C
F -- "false" --> D
E -- "no (key absent)" --> G["defaultEnabled = false (changed in this PR)"]
G --> D
C --> H{hiddenDelay elapsed?}
H -- "yes" --> I[discardHiddenWebViewForMemory → replaces WKWebView]
H -- "no" --> J[Keep live WKWebView in liveHidden state]
D --> J
J --> K[Workspace shown → same WKWebView rebinds, no reload]
I --> L[Workspace shown → new WKWebView restores from history]
Reviews (1): Last reviewed commit: "fix: keep browser webviews alive by defa..." | Re-trigger Greptile |
Summary
Fixes #4387
Verification
Note
Medium Risk
Changes the default browser tab lifecycle behavior by disabling hidden WebView discarding unless explicitly enabled, which could affect memory usage and tab restore behavior. Risk is mitigated by updated and new unit tests around discard/restore and workspace hide/show identity preservation.
Overview
Makes Browser Memory Saver opt-in by changing
BrowserHiddenWebViewDiscardPolicy.defaultEnabledand the settings schemabrowser.discardHiddenWebViewsdefault fromtruetofalse, so normal workspace hide/show keeps the same liveWKWebViewand DOM state.Updates
BrowserPanelWebViewLifecycleTeststo manage discard-relatedUserDefaultsper-test, skip appropriately when environment overrides make behavior unobservable, add a regression test asserting WebView identity is preserved when hidden past the discard delay with the policy disabled, and explicitly enable the policy in discard/restore tests to keep coverage.Reviewed by Cursor Bugbot for commit 233dbe4. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by cubic
Make Browser Memory Saver opt-in so hidden tabs no longer auto-discard. Keeps the live
WKWebViewand DOM when a workspace is hidden and re-shown, fixing the refresh regression (addresses #4387).BrowserHiddenWebViewDiscardPolicyto disabled; updatediscardHiddenWebViewsdefault inweb/data/cmux.schema.jsontofalse.WKWebViewidentity across workspace hide/show to avoid reloads.Written for commit 233dbe4. Summary will update on new commits. Review in cubic