Skip to content

fix(browser): hide spinner on main-frame load errors in BrowserClient#68

Merged
LandWarderer2772 merged 1 commit into
AppFuton:develfrom
jim-daf:fix-browserclient-onreceivederror
May 17, 2026
Merged

fix(browser): hide spinner on main-frame load errors in BrowserClient#68
LandWarderer2772 merged 1 commit into
AppFuton:develfrom
jim-daf:fix-browserclient-onreceivederror

Conversation

@jim-daf
Copy link
Copy Markdown

@jim-daf jim-daf commented May 15, 2026

Closes #67.

BrowserClient flips BrowserCallback.onLoadingStateChanged on onPageStarted (true) and onPageFinished (false), but does not override onReceivedError. On many failure modes (DNS, certificate, offline, 4xx/5xx) onPageFinished does not always fire after the error, so the toolbar / progress UI stays stuck on isLoading = true even though the page never loaded.

Add a main-frame-only onReceivedError override that flips isLoading = false too:

override fun onReceivedError(
    view: WebView?,
    request: WebResourceRequest?,
    error: WebResourceError?,
) {
    super.onReceivedError(view, request, error)
    if (request?.isForMainFrame == true) {
        callback.onLoadingStateChanged(isLoading = false)
    }
}

isForMainFrame keeps a single blocked sub-resource from flipping the spinner off while the main load is still running.

BrowserClient flips BrowserCallback.onLoadingStateChanged on
onPageStarted (true) and onPageFinished (false), but does not
override onReceivedError. On many failure modes (DNS, certificate,
offline, 4xx/5xx) onPageFinished does not always fire after the
error, so the toolbar / progress UI stays stuck on isLoading = true
even though the page never loaded.

Add a main-frame-only onReceivedError override that flips
isLoading = false too. isForMainFrame keeps a single blocked
sub-resource from flipping the spinner off while the main load is
still running.
@LandWarderer2772
Copy link
Copy Markdown
Member

Thanks, ill test it out and then merge. :D

@LandWarderer2772
Copy link
Copy Markdown
Member

@LandWarderer2772 LandWarderer2772 self-assigned this May 16, 2026
@LandWarderer2772 LandWarderer2772 moved this from Backlog to In review in Futon project May 16, 2026
@LandWarderer2772 LandWarderer2772 merged commit bb6eb67 into AppFuton:devel May 17, 2026
1 check failed
@github-project-automation github-project-automation Bot moved this from In review to Done in Futon project May 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

BrowserClient leaves spinner stuck on isLoading=true when a load fails

2 participants