Skip to content

fix: token input screen is closed after switching between Toolbox and browser #72

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

Merged
merged 11 commits into from
Apr 8, 2025

Conversation

fioan89
Copy link
Collaborator

@fioan89 fioan89 commented Apr 8, 2025

  • rough draft to fix UI state management in the authentication flow which today has 3 pages. If user closes
    Toolbox in any of these three pages (for example to go and copy the token from a browser), then when it comes back in Toolbox does not remember which was the last visible UiPage.

  • until JetBrains improves Toolbox state management, we can work around the problem by having only one
    UiPage with three "steps" in it, similar to a wizard. With this approach we can have complete control over
    the state of the page.

  • to be noted that I've also looked over two other approaches. The first idea was to manage the stat
    ourselves, but that didn’t work out as Toolbox doesn’t clearly tell us when the user clicks the Back
    button vs. when they close the window. So we can’t reliably figure out which page to show when it reopens.

  • another option was changing the auth flow entirely and adding custom redirect URLs for Toolbox plugins.
    But that would only work with certain Coder versions, which might not be ideal.

  • resolves token input screen is closed after I closed Toolbox popup to copy token in browser #45

fioan89 added 2 commits April 8, 2025 01:46
… browser

- rough draft to fix UI state management in the authentication flow which today has 3 pages. If user closes
  Toolbox in any of these three pages (for example to go and copy the token from a browser), then when it comes back in Toolbox does not remember which was the last visible UiPage.
- until JetBrains improves Toolbox state management, we can work around the problem by having only one
  UiPage with three "steps" in it, similar to a wizard. With this approach we can have complete control over
  the state of the page.

- to be noted that I've also looked over two other approaches. The first idea was to manage the stat
  ourselves, but that didn’t work out as Toolbox doesn’t clearly tell us when the user clicks the Back
  button vs. when they close the window. So we can’t reliably figure out which page to show when it reopens.
- another option was changing the auth flow entirely and adding custom redirect URLs for Toolbox plugins.
  But that would only work with certain Coder versions, which might not be ideal.

- resolves #45
@fioan89 fioan89 requested review from matifali and bcpeinhardt April 8, 2025 09:13
fioan89 added 9 commits April 8, 2025 20:52
- close page property is no longer needed by the wizard steps
- getToken was moved into the context
- by yielding the coroutine in three key points
- error handling is also simplified.
- rest api is now suspendable giving a chance to the user to propagate the cancellation exception during the execution
- reset the auto-login flag once the user hits back
- compileTestKotlin is not called when we simply do `clean copyPlugin`
@fioan89 fioan89 marked this pull request as ready for review April 8, 2025 21:07
@fioan89 fioan89 merged commit 4c68440 into main Apr 8, 2025
5 checks passed
@fioan89 fioan89 deleted the fix-auth-flow-state-management branch April 8, 2025 21:08
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.

token input screen is closed after I closed Toolbox popup to copy token in browser
2 participants