@@ -3,7 +3,6 @@ package com.coder.toolbox
33import com.coder.toolbox.store.CoderSecretsStore
44import com.coder.toolbox.store.CoderSettingsStore
55import com.coder.toolbox.util.toURL
6- import com.coder.toolbox.views.CoderPage
76import com.jetbrains.toolbox.api.core.diagnostics.Logger
87import com.jetbrains.toolbox.api.core.os.LocalDesktopManager
98import com.jetbrains.toolbox.api.localization.LocalizableStringFactory
@@ -14,10 +13,8 @@ import com.jetbrains.toolbox.api.remoteDev.states.EnvironmentStateColorPalette
1413import com.jetbrains.toolbox.api.remoteDev.ui.EnvironmentUiPageManager
1514import com.jetbrains.toolbox.api.ui.ToolboxUi
1615import kotlinx.coroutines.CoroutineScope
17- import kotlinx.coroutines.delay
1816import java.net.URL
1917import java.util.UUID
20- import kotlin.time.Duration.Companion.milliseconds
2118
2219@Suppress(" UnstableApiUsage" )
2320data class CoderToolboxContext (
@@ -91,26 +88,4 @@ data class CoderToolboxContext(
9188 i18n.ptrl(" OK" )
9289 )
9390 }
94-
95- /* *
96- * Forces the title bar on the main page to be refreshed
97- */
98- suspend fun refreshMainPage () {
99- // the url/title on the main page is only refreshed if
100- // we're navigating to the main env page from another page.
101- // If TBX is already on the main page the title is not refreshed
102- // hence we force a navigation from a blank page.
103- ui.showUiPage(CoderPage .emptyPage(this ))
104-
105-
106- // Toolbox uses an internal shared flow with a buffer of 4 items and a DROP_OLDEST strategy.
107- // Both showUiPage and showPluginEnvironmentsPage send events to this flow.
108- // If we emit two events back-to-back, the first one often gets dropped and only the second is shown.
109- // To reduce this risk, we add a small delay to let the UI coroutine process the first event.
110- // Simply yielding the coroutine isn't reliable, especially right after Toolbox starts via URI handling.
111- // Based on my testing, a 5–10 ms delay is enough to ensure the blank page is processed,
112- // while still short enough to be invisible to users.
113- delay(10 .milliseconds)
114- envPageManager.showPluginEnvironmentsPage()
115- }
11691}
0 commit comments