Skip to content

Conversation

@QianKuang8
Copy link
Contributor

@QianKuang8 QianKuang8 commented Nov 13, 2025

Description

Discussion in #8085

Add a reload button and an action

With manual test, it works well in normal case. Not 100% sure whether it would work when UI freezes.

video.mp4

AI Code Review

  • Team members only: AI review runs automatically when PR is opened or marked ready for review
  • Team members can also trigger a review by commenting @continue-review

Checklist

  • [] I've read the contributing guide
  • [] The relevant docs, if any, have been updated or created
  • [] The relevant tests, if any, have been updated or created

Screen recording or screenshot

image image

Tests

[ What tests were added or updated to ensure the changes work as expected? ]


Summary by cubic

Adds a Reload button for the Continue tool window that rebuilds the JCEF browser and tool window content to recover from freezes or crashes.

  • New Features
    • Added ReloadBrowserAction and toolbar button to dispose the current browser, create a new one, rebuild tool window content, and focus the input.
    • ContinueBrowserService now provides reload() and load(); the old instance is disposed after UI updates to avoid race conditions.

Written for commit 8bfc78d. Summary will update automatically on new commits.

@QianKuang8 QianKuang8 requested a review from a team as a code owner November 13, 2025 06:27
@QianKuang8 QianKuang8 requested review from Patrick-Erichsen and removed request for a team November 13, 2025 06:27
@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Nov 13, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Nov 18, 2025
@QianKuang8 QianKuang8 changed the title Feat: add JCEF reload action feat: add JCEF reload action Nov 18, 2025
Comment on lines 24 to 27
private val myJBCefClient: JBCefClient = JBCefApp.getInstance().createClient().apply {
setProperty(JBCefClient.Properties.JS_QUERY_POOL_SIZE, 200)
}
private val browser: JBCefBrowser = JBCefBrowser.createBuilder().setOffScreenRendering(true).setClient(myJBCefClient).build()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come were changing this logic?

Copy link
Contributor Author

@QianKuang8 QianKuang8 Nov 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit e998ae8 was added to try address the issue mentioned in #8085 (comment)

[5473397] WARN - #c.i.u.j.JBCefJSQuery - Set the property JBCefClient.Properties.JS_QUERY_POOL_SIZE to use JBCefJSQuery after the browser has been created

If you have concerns about the fix, I can revert that commit so we can focus on the reload action in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

revert the commit in 8bfc78d

Copy link
Collaborator

@Patrick-Erichsen Patrick-Erichsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain the changes here? I'm weary to modify the core browser logic and potentially making things worse than they already are.

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Issues and PRs Nov 19, 2025
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:L This PR changes 100-499 lines, ignoring generated files. labels Nov 19, 2025
@Patrick-Erichsen
Copy link
Collaborator

@QianKuang8 I see you pushed some more commits, appreciate you moving this forward but a quick bump on my comment above:

Can you explain the changes here? I'm weary to modify the core browser logic and potentially making things worse than they already are.

Copy link
Contributor Author

@QianKuang8 QianKuang8 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, previously I didn't understand your comment.
Add some explanation on my change.

Also, currently the reload action still not work when freeze. And I have worked on this for few days. I would update the PR if I found a way to make it work.

}
}

class ReloadBrowserAction: ContinueToolbarAction() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An action to trigger the browser reload

<reference ref="continue.newContinueSession"/>
<reference ref="continue.viewHistory"/>
<reference ref="continue.openConfigPage"/>
<reference ref="continue.reloadPage" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add an button

Comment on lines 61 to 64
fun Project.getBrowser(): ContinueBrowser? {
if (isDisposed)
return null
return service<ContinueBrowserService>().browser
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other component still use this function to get browser. No changes here.

* Reloads the browser by disposing the current one and creating a new one.
* This method is intended for use when browser is frozen (unresponsive).
*/
fun reload() {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only the new reload action use this function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What the function do

  1. dispose the old browser
  2. create a new browser

Comment on lines 20 to +23
override fun dispose() {
if (browser != null)
Disposer.dispose(browser)
browser?.let { Disposer.dispose(it) }
browser = null
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will set the browser to null after dispose

private var browser: ContinueBrowser? = null

init {
load()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the init block to set the value of browser

return null
}
val newBrowser = ContinueBrowser(project)
Disposer.register(this, newBrowser)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Browser would be disposed when the BrowserService is disposed after the registration

browser = null
}

private fun load(): ContinueBrowser? {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of the logic is same to

private val browser: ContinueBrowser? =
        if (JBCefApp.isSupported())
            ContinueBrowser(project)
        else null

@Patrick-Erichsen
Copy link
Collaborator

Got it, thank you for the detailed comments! This makes more sense, seems like a good patch until we fix the underlying freeze issues.

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 21, 2025
@Patrick-Erichsen Patrick-Erichsen merged commit 1fa18ed into continuedev:main Nov 21, 2025
53 of 56 checks passed
@github-project-automation github-project-automation bot moved this from In Progress to Done in Issues and PRs Nov 21, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Nov 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

lgtm This PR has been approved by a maintainer size:M This PR changes 30-99 lines, ignoring generated files.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants