Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positron on Workbench: opening folder causes onUnload browser dialog to show #6062

Open
sharon-wang opened this issue Jan 21, 2025 · 1 comment
Labels
area: workbench Issues related to Workbench category. bug Something isn't working sharp-edge

Comments

@sharon-wang
Copy link
Member

sharon-wang commented Jan 21, 2025

System details:

Positron and OS details:

I think this is likely from the 1.96 merge.

Interpreter details: any

Describe the issue:

In Positron on Workbench, @Trevor-Reid noted that the following popup shows every time the folder is changed:

Image

I was able to reproduce this issue in a local dev build of Positron Server Web as well.

This popup shows even though there may not be any pending changes that could be lost.

I tagged this as a sharp-edge because it is quite easy to run into this popup: any folder change, tab close or tab refresh, and possibly other actions too.

Steps to reproduce the issue:

In Positron Server Web or Positron on Workbench, either

  • do an action that results in a folder being opened, such as:
    • Open Folder
    • Creating a new project via the Project Wizard
    • Clicking on a folder/workspace in the Recent section of the Welcome page
  • or, do one of the following to navigate away from the tab:
    • Refreshing the page
    • Closing the tab

Then, the popup as shown above appears.

Expected or desired behavior:

Previously, this "Changes you made may not be saved" dialog did not appear when opening a folder and there are no pending changes in an editor.

Were there any error messages in the UI, Output panel, or Developer Tools console?

Developer Tools console:

INFO [lifecycle] onBeforeUnload triggered and handled with veto support
ERR [lifecycle] Long running operations before shutdown are unsupported in the web (id: positron.runtimeStartup.clearWorkspaceSessions)

These messages look to be coming from https://github.com/posit-dev/positron/blob/main/src/vs/workbench/services/lifecycle/browser/lifecycleService.ts.

@sharon-wang sharon-wang added area: workbench Issues related to Workbench category. bug Something isn't working sharp-edge labels Jan 21, 2025
@Trevor-Reid
Copy link

Trevor-Reid commented Jan 21, 2025

Also an easy way to see is to reload the page as well as opening a folder.

@juliasilge juliasilge added this to the 2025.03 Pre-Release milestone Jan 22, 2025
jmcphers added a commit that referenced this issue Jan 23, 2025
This change fixes an issue in which Positron prompts to save changes
whenever you try to navigate away from the page in web mode.

It turns out that in web mode (specifically), async shutdown operations
aren't supported, and trying to use them results in this behavior. The
fix is simply to not clear the session list in web mode, which should be
fine as the reason we need to do this has to do with multiple Electron
windows.

Addresses #6062. 

### QA Notes

As noted in the issue it's very easy to hit this, so should be easy to
verify as well!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: workbench Issues related to Workbench category. bug Something isn't working sharp-edge
Projects
None yet
Development

No branches or pull requests

3 participants