Skip to content

fix(webview): serialize inline webview visibility transitions#516

Open
beruro wants to merge 1 commit into
developfrom
feat/inline-webview-lifecycle
Open

fix(webview): serialize inline webview visibility transitions#516
beruro wants to merge 1 commit into
developfrom
feat/inline-webview-lifecycle

Conversation

@beruro

@beruro beruro commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Fix a race in inline webview visibility transitions where rapid show/hide could leave a native WKWebView shown offscreen or hidden while active.
  • Serialize per-owner native mutations through a transition queue + generation counter: a newer visibility intent invalidates queued work before it reaches Tauri, while an in-flight mutation is allowed to finish.
  • Fold the show call into updatePosition({ force, show }) and gate updatePosition on isVisible so offscreen owners never reposition.

Test plan

  • tsc --noEmit passes (pre-commit hook, staged files clean).
  • pnpm vitest run for the added specs: useInlineWebviewNativeVisibility, useWebviewLayout, BrowserCore.webviewRetention.
  • Manual: rapidly toggle a browser / inline-webview tab and confirm no offscreen-visible or hidden-active webview.

Based on latest develop.

Native WKWebView show/hide mutations could race when visibility flipped
quickly, leaving an inline webview shown offscreen or hidden while active.

- Serialize per-owner native mutations through a transition queue and use a
  generation counter so a newer visibility intent invalidates queued work
  before it reaches Tauri, while an in-flight mutation is allowed to finish.
- Fold the show call into updatePosition({ force, show }) and gate
  updatePosition on isVisible so offscreen owners never reposition.

Adds unit tests for native-visibility sequencing and layout gating.
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