Skip to content

fix(browser): settle loading after history restoration - #3470

Merged
bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/browser-history-loading
Oct 20, 2026
Merged

bobleer merged 2 commits into
GCWing:mainfrom
bobleer:bob/browser-history-loading

Conversation

@bobleer

@bobleer bobleer commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Fix the embedded browser's loading spinner remaining active after Back restores a usable page. Reconcile native navigation notifications with document readiness after commit, and observe cached-page and same-document history events.

Type and Areas

Type: Bug fix

Areas: Web UI embedded browser lifecycle and regression tests

Motivation / Impact

The loading indicator previously depended on native completion notifications, which may be absent or late during history restoration. Both browser surfaces now settle loading when the current document reports readiness. View labels and navigation sequences reject stale reports, and readiness is never probed before commit while the old document may still be visible.

Verification

  • Passed: pnpm --dir src/web-ui run test:run src/app/scenes/browser src/infrastructure/runtime/windowVisibility.test.ts src/infrastructure/api/adapters/peer-device-adapter.test.ts — 11 files, 135 tests.
  • Passed: pnpm run check:web.
  • Passed: focused ESLint on useEmbeddedBrowserWebview.ts and browserPageLifecycleScript.ts.
  • Passed: an isolated native macOS WKWebView fixture navigated between two local pages and restored the first through Back. The generated readiness script settled all three loads while the fixture deliberately ignored native completion for loading-state updates. This is native-engine verification, not a full packaged-client end-to-end test.
  • Regression coverage includes Back/Forward without native completion, duplicate commit notifications, stale sequences and other view labels, same-document URL changes, subscription cleanup, and avoiding premature readiness probes.

Reviewer Notes

Uses the existing browser evaluation command and event permission; no Rust, persisted-data, or remote-protocol changes. Peer routing is covered by local adapter tests. Remote workspace, remote control, Peer Device Mode, and Detached Dispatch were not exercised against live remote hosts.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

bobleer and others added 2 commits October 20, 2026 14:20
Reconcile native page-load events with document readiness after commit, including cached and same-document history restores. Ignore stale view and navigation reports and release both event subscriptions together.

Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>
Keep the new lifecycle reconciliation independent of existing page helpers so duplicate and same-URL load events do not add redundant auxiliary listeners.

Co-authored-by: OpenBitFun <318544290+bitfun-ai@users.noreply.github.com>
@bobleer
bobleer merged commit 1be6f7d into GCWing:main Oct 20, 2026
9 checks passed
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