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

Fix restoring cloud projects that have been closed (e.g. from inactivity) #7584

Merged
merged 12 commits into from
Aug 25, 2023

Conversation

somebody1234
Copy link
Contributor

Pull Request Description

Fix issues restoring cloud projects that have been closed.
On current develop, the frontend assumes cloud projects are still open from the last time they were open. If this is not the case, it tries to open WebSocket endpoints that no longer exist

Important Notes

For a relatively easy way to test:

  • Run Enso.dmg or ./ide run watch
  • Open a cloud project
  • Refresh Electron to make sure restoration is working
  • Go to localhost:8080
  • Close the project
  • Refresh Electron to make sure startup + restoration is working

Should also test restoring local projects to make sure that didn't break.

I was unable to properly test cloud projects (the one I tested with opened, but was blank with just the IDE background and no cursor and no nodes, for some reason)

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • Screenshots/screencasts have been attached, if there are any visual changes. For interactive or animated visual changes, a screencast is preferred.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.
    • If GUI codebase was changed, the GUI was tested when built using ./run ide build.

@somebody1234 somebody1234 added the CI: No changelog needed Do not require a changelog entry for this PR. label Aug 15, 2023
@somebody1234
Copy link
Contributor Author

i think there are still issues with cloud project behavior - e.g. if they should open in the background

@PabloBuchu PabloBuchu self-assigned this Aug 18, 2023
@PabloBuchu
Copy link
Contributor

Ok so when the cloud project isn't available anymore we don't throw any errors that ok but the working ones are not available under currently opened workspace..

Screen.Recording.2023-08-18.at.12.06.00.mov

When switching to from cloud to local tab I see my project was dropped in the background (I havent opened any local project)

Retrieving local project after closing Enso works fine

@somebody1234
Copy link
Contributor Author

@PabloBuchu that should be fixed now

@somebody1234
Copy link
Contributor Author

actually nvm... one second

@PabloBuchu
Copy link
Contributor

Not sure what was fixed but works completely the same:

  1. Just switch between modes drops currently opened project in the background
  2. Closing Enso with opened cloud project and reopning doesn't bring it back
Screen.Recording.2023-08-18.at.17.29.43.mov

@somebody1234
Copy link
Contributor Author

@PabloBuchu you might have forgotten to rebuild enso

@PabloBuchu
Copy link
Contributor

PabloBuchu commented Aug 18, 2023

@somebody1234 hmm I thought I rebuild it.. The problem with dropping project in background on mode switch is gone but still does not put active workspace after I close Enso with cloud project ready to open

@PabloBuchu
Copy link
Contributor

No it doesnt work both bugs are still present... Try to reopen Enso couple of times

@somebody1234
Copy link
Contributor Author

oh nvm. if you're reopening relatively quickly i think i know what the issue could be

@somebody1234
Copy link
Contributor Author

still can't repro unfortunately... it's definitely a problem, i might need more specific repro steps?
can you repro on windows?

@PabloBuchu
Copy link
Contributor

Ok so problem with dropping project when switching between cloud / local is gone.

Still If I have running cloud project and close Enso. After relaunch can use top icon to go to workspace.. (the same for local works fine)

Screen.Recording.2023-08-21.at.11.48.17.mp4

@somebody1234
Copy link
Contributor Author

somebody1234 commented Aug 21, 2023

@PabloBuchu could you possibly record with localstorage open? (Application -> Local Storage), and have the enso key expanded

(note that if you're opening the project somewhere else, e.g. the browser or run watch, so that it doesn't exist in localStorage, then not opening the project in the background is the intended behavior)
(but, if that's what is happening, it should be doable to load whichever cloud project is running, just want to make sure it's not some other issue that doing this would silently hide)

if the localStorage thing isn't helpful, maybe change this:

    const [projectStartupInfo, setProjectStartupInfo] =
        React.useState<backendModule.ProjectStartupInfo | null>(null);

into:

    const [projectStartupInfo, setProjectStartupInfo] =
        hooks.useDebugState<backendModule.ProjectStartupInfo | null>(null);

@PabloBuchu PabloBuchu added CI: Ready to merge This PR is eligible for automatic merge and removed CI: Ready to merge This PR is eligible for automatic merge labels Aug 25, 2023
@PabloBuchu
Copy link
Contributor

@somebody1234 I recorded a properly working flow in develop vs this branch with localStorage.enso expanded.

Screen.Recording.2023-08-25.at.09.05.31.mp4

@somebody1234
Copy link
Contributor Author

somebody1234 commented Aug 25, 2023

side note: i just realized that projects that aren't visible, are not closed (because of course, the frontend doesn't know about them). maybe it means the backend should eventually close the user's previously opened project itself

edit: or perhaps they should stay open, because the user may have it open on another device???

@PabloBuchu PabloBuchu added the CI: Ready to merge This PR is eligible for automatic merge label Aug 25, 2023
@somebody1234 somebody1234 added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Aug 25, 2023
@PabloBuchu PabloBuchu removed the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Aug 25, 2023
@mergify mergify bot merged commit 37c487f into develop Aug 25, 2023
27 checks passed
@mergify mergify bot deleted the wip/sb/restore-closed-cloud-project branch August 25, 2023 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: No changelog needed Do not require a changelog entry for this PR. CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants