fix: prevent iOS WKWebView JS throttling from zero-area frame#100
fix: prevent iOS WKWebView JS throttling from zero-area frame#100panosinthezone wants to merge 1 commit into
Conversation
Change WKWebView initial frame from .zero to 1x1 so iOS considers the WebView composited from creation and does not clear ActivityState::IsVisible. Add .opacity(0) to HiddenEmailSignersView so the WebView is truly invisible but remains composited — matching the approach used in the React Native SDK (crossmint-sdk#1878). Co-Authored-By: Panayiotis Halios <panos@paella.dev>
Original prompt from Panayiotis
|
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
Reviews (1): Last reviewed commit: "fix: prevent iOS WKWebView JS throttling..." | Re-trigger Greptile |
Summary
Port of crossmint-sdk#1878 — same root cause, same fix, different platform.
A
WKWebView(frame: .zero, ...)causes WebKit to clearActivityState::IsVisible, which triggersupdateThrottleState()→dropVisibleActivity()— the WebContent process loses its foreground assertion and becomes eligible for suspension, timer throttling, and priority termination under memory pressure.Changes:
CrossmintWebView.swift:WKWebView(frame: .zero, ...)→WKWebView(frame: CGRect(x: 0, y: 0, width: 1, height: 1), ...)so the backing layer is composited from creationView+NonCustodialSigner.swift:.frame(width: 20, height: 20)→.frame(width: 1, height: 1)+.opacity(0)— the previous 20×20 was unnecessary padding; a 1×1 composited layer is sufficient, and.opacity(0)ensures the view is truly invisible while keeping iOS's visibility flag setWebKit source references: see detailed walkthrough.
Link to Devin session: https://crossmint.devinenterprise.com/sessions/aa42293821a24fee86c25e350715efd5
Requested by: @panosinthezone