fix: decouple snackbar display from caller so busy state always resets#314
Merged
Conversation
logAndShowError/Warning/Info were suspend functions that called
ui.showSnackbar directly on the caller's coroutine. Toolbox keeps that
coroutine suspended for the entire lifetime of the snackbar and cancels
it (rather than resuming) when the snackbar is dismissed. As a result,
dismissing a snackbar cancelled the calling coroutine and skipped any
code meant to run after the error was shown - most visibly leaving
coderHeaderPage.isBusy stuck at true after a failed URI handling.
Introduce a fire-and-forget CoderToolboxContext.showSnackbar that
launches the snackbar on the plugin scope, swallowing the expected
CancellationException on dismissal. The logAndShow* helpers become
regular (non-suspend) functions delegating to it, so callers continue
immediately and their cleanup always runs.
Also harden the busy-state handling in CoderRemoteProvider.handleUri and
deferredLinkHandler with try/finally so isBusy is reset on every path,
and drop the fragile onConnect.andThen { isBusy = false } chaining.
ErrorReporter now reuses context.showSnackbar instead of its own launch.
code-asher
approved these changes
Jun 4, 2026
| } | ||
| linkHandler.handle(params, newUrl, this.client!!, this.cli!!) | ||
| } finally { | ||
| coderHeaderPage.isBusy.update { false } |
Member
There was a problem hiding this comment.
nbd at all but I think these changes make the coderHeaderPage.isBusy.update { false } in the parent catch unnecessary
Collaborator
Author
There was a problem hiding this comment.
Good point. Thx. Fixed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
logAndShowError/Warning/Info were suspend functions that called
ui.showSnackbar directly on the caller's coroutine. Toolbox keeps that
coroutine suspended for the entire lifetime of the snackbar and cancels
it (rather than resuming) when the snackbar is dismissed. As a result,
dismissing a snackbar cancelled the calling coroutine and skipped any
code meant to run after the error was shown - most visibly leaving
coderHeaderPage.isBusy stuck at true after a failed URI handling.
Introduce a fire-and-forget CoderToolboxContext.showSnackbar that
launches the snackbar on the plugin scope, swallowing the expected
CancellationException on dismissal. The logAndShow* helpers become
regular (non-suspend) functions delegating to it, so callers continue
immediately and their cleanup always runs.
Also harden the busy-state handling in CoderRemoteProvider.handleUri and
deferredLinkHandler with try/finally so isBusy is reset on every path,
and drop the fragile onConnect.andThen { isBusy = false } chaining.
ErrorReporter now reuses context.showSnackbar instead of its own launch.