MixinNetwork / MixinNetwork/flutter-plugins

[desktop_webview_window]: addOnUrlRequestCallback not triggered on SPA (e.g. React) client-side route changes

Open
#418 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
512
Forks
292
Avg merge
15h 8m
Merged PRs (30d)
7

Description

Hi, thank you for this helpful plugin!

I'm using desktop_webview_window in my Flutter Linux app to embed a webview. The addOnUrlRequestCallback works fine for traditional full-page navigations, but it's not triggered when navigating within a Single Page Application (SPA) such as a React app that uses client-side routing (e.g. React Router or Next.js).

Steps to Reproduce:

  1. Load a React-based SPA (e.g. a local or deployed React app) in the webview.
  2. Use the app's navigation (e.g. Use navigate or clicking on a element to route to another page).
  3. Observe that addOnUrlRequestCallback is not called on these URL changes.

Expected Behavior:

  1. The callback should also be triggered when the URL changes due to client-side routing in SPAs, not just for full-page navigations.
  2. Alternatively, we could have a new dedicated callback specifically for detecting URL changes in SPA apps.

Actual Behavior:
addOnUrlRequestCallback is only triggered for full page loads (e.g. window.location.href = '...') and not for history API-based routing (history.pushState, replaceState), which is commonly used in SPAs.

Environment:
OS: Linux
Flutter version: 3.29.2
Plugin version: ^0.2.3

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Reproduce the issue in a Flutter Linux app with a React SPA, then trace the desktop_webview_window handling behind addOnUrlRequestCallback and history.pushState/replaceState; done means SPA route changes are detected through the agreed callback behavior and covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
flutter, react
Domain
desktop, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.