Skip to content

Bypass WebView fetch for native event dispatch#18

Open
tbtmuse wants to merge 1 commit intoNativePHP:mainfrom
tbtmuse:fix/race-condition-native-event-dispatch
Open

Bypass WebView fetch for native event dispatch#18
tbtmuse wants to merge 1 commit intoNativePHP:mainfrom
tbtmuse:fix/race-condition-native-event-dispatch

Conversation

@tbtmuse
Copy link

@tbtmuse tbtmuse commented Feb 15, 2026

This PR replaces the fetch() call with a direct platform bridge call on both Android and iOS, so native events bypass the WebView transport entirely.

Changes

Android (NativeActionCoordinator.kt, WebViewManager.kt):

  • Removed fetch() from injected JS
  • Added direct phpBridge.handleLaravelRequest() call on a background thread
  • Changed phpBridge visibility from private to internal in WebViewManager

iOS (ContentView.swift):

  • Removed fetch() from injected JS in notifyLaravel()
  • Added direct NativePHPApp.laravel(request:) call with proper RequestData

Dispatch native events directly via platform bridge instead of WebView
fetch() to prevent lastPostData race condition with Livewire requests.
@tbtmuse tbtmuse changed the title fix: bypass WebView fetch for native event dispatch Bypass WebView fetch for native event dispatch Feb 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants