Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit81921d7

Browse files
authored
Improve uri handling workflow (#214)
This PR addresses two issues in the URI handler workflow to improve userexperience and reliability.1. Streamline version fallback behaviorProblem: When the URI handler receives a build number that is no longeravailable, the application would fall back to the latest version butdisplay a confirmation dialog. Netflix reported that this confirmationdialog disrupts the user workflow.Solution: Removed the confirmation dialog and replaced it with logging.The handler now silently falls back to the latest available version whenthe requested build number is unavailable, maintaining a seamless userexperience.2. Fix connect page not displaying when Toolbox is already openProblem: When Toolbox is already running and a URI is executed, theconnect page fails to display. Investigation revealed that the UI eventemitted via MutableSharedFlow(replay = 0) is lost because the UIcollector is not yet active when processEvent() is called.Solution: Introduced a 66-100ms delay before emitting the UI event. Thisdelay ensures the collector is ready to receive events, preventing themfrom being dropped. The timing was determined through testing andappears to account for the collector initialization time.Note: The delay infix#2 is a workaround for what appears to be atiming issue with the MutableSharedFlow collector initialization.
1 parent3ac53e8 commit81921d7

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

‎CHANGELOG.md‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,14 @@
22

33
##Unreleased
44

5+
###Changed
6+
7+
- URI handling no longer waits for confirmation to use latest build if the provided build number is too old
8+
9+
###Fixed
10+
11+
- IDE is now launched when URI is handled by an already running Toolbox instance.
12+
513
##0.7.1 - 2025-10-13
614

715
###Fixed

‎src/main/kotlin/com/coder/toolbox/util/CoderProtocolHandler.kt‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import kotlinx.coroutines.time.withTimeout
2626
importjava.net.URI
2727
importjava.util.UUID
2828
importkotlin.time.Duration
29+
importkotlin.time.Duration.Companion.milliseconds
2930
importkotlin.time.Duration.Companion.minutes
3031
importkotlin.time.Duration.Companion.seconds
3132
importkotlin.time.toJavaDuration
@@ -111,6 +112,18 @@ open class CoderProtocolHandler(
111112
CoderCliSetupContext.token= token
112113
}
113114
CoderCliSetupWizardState.goToStep(WizardStep.CONNECT)
115+
116+
// If Toolbox is already opened and URI is executed the setup page
117+
// from below is never called. I tried a couple of things, including
118+
// yielding the coroutine - but it seems to be of no help. What works
119+
// delaying the coroutine for 66 - to 100 milliseconds, these numbers
120+
// were determined by trial and error.
121+
// The only explanation that I have is that inspecting the TBX bytecode it seems the
122+
// UI event is emitted via MutableSharedFlow(replay = 0) which has a buffer of 4 events
123+
// and a drop oldest strategy. For some reason it seems that the UI collector
124+
// is not yet active, causing the event to be lost unless we wait > 66 ms.
125+
// I think this delay ensures the collector is ready before processEvent() is called.
126+
delay(100.milliseconds)
114127
context.ui.showUiPage(
115128
CoderCliSetupWizardPage(
116129
context, settingsPage, visibilityState,true,
@@ -369,10 +382,7 @@ open class CoderProtocolHandler(
369382
val buildNumberIsNotAvailable= availableVersions.firstOrNull { it.contains(buildNumber) }==null
370383
if (buildNumberIsNotAvailable) {
371384
val selectedIde= availableVersions.maxOf { it }
372-
context.logAndShowInfo(
373-
"$productCode-$buildNumber not available",
374-
"$productCode-$buildNumber is not available, we've selected the latest$selectedIde"
375-
)
385+
context.logger.info("$productCode-$buildNumber is not available, we've selected the latest$selectedIde")
376386
return selectedIde
377387
}
378388
return"$productCode-$buildNumber"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp