[FIX] Flutter WebView: load /?_embed=1 to skip plugin-served DevShell #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ep/May14-2026/FlutterEmbedQuery"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
After the framework-neutral refactor, vite serves the DevShell parent
page at
/and the consumer's app at/?_embed=1. Flutter WebView washitting
/and rendering the phone-frame DevShell HTML inside itself —a phone-frame inside a phone-shell, then trying to iframe the app at a
URL that the WebView couldn't follow correctly.
Fix
_validatedUrl()to always append?_embed=1to the cache-serverURL. Vite's
transformIndexHtmlsees the query and returns theconsumer's app HTML. In prod the plugin doesn't run server-side at all
(
apply: "serve"), so the query is a harmless no-op.Applied in three places:
packages/vite-plugin/scaffold/lib/shell/webview_screen.dart—the template; future consumers scaffolded from this get the fix
examples/todo/shell-app/lib/shell/webview_screen.dart—existing example, scaffolded before this change
docs/flutter-shell.md— new "?_embed=1— always" sectionso existing consumers can apply the same one-line patch
Credit: client developer on apprabbit-studio caught this during
their framework-neutral migration.
Co-Authored-By: Claude Opus 4.7 (1M context) noreply@anthropic.com
After the framework-neutral refactor, vite serves the DevShell parent page at `/` and the consumer's app at `/?_embed=1`. Flutter WebView was hitting `/` and rendering the phone-frame DevShell HTML inside itself — a phone-frame inside a phone-shell, then trying to iframe the app at a URL that the WebView couldn't follow correctly. Fix `_validatedUrl()` to always append `?_embed=1` to the cache-server URL. Vite's `transformIndexHtml` sees the query and returns the consumer's app HTML. In prod the plugin doesn't run server-side at all (`apply: "serve"`), so the query is a harmless no-op. Applied in three places: - `packages/vite-plugin/scaffold/lib/shell/webview_screen.dart` — the template; future consumers scaffolded from this get the fix - `examples/todo/shell-app/lib/shell/webview_screen.dart` — existing example, scaffolded before this change - `docs/flutter-shell.md` — new "`?_embed=1` — always" section so existing consumers can apply the same one-line patch Credit: client developer on apprabbit-studio caught this during their framework-neutral migration. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>