Commit 3fd0c16
committed
fix: url refresh after switching deployments
The main env header page API is quite limiting, in the sense that the title is never allowed to change.
Today we display the Coder URL as the title. However, if the user switches between two deployments via
log out and then log in, the URL is never refreshed, leading to a confusing UI (URL is old, while workspaces
are from the new deployment)
JetBrains suggested a workaround in https://youtrack.jetbrains.com/issue/TBX-14421/ by creating a new env
page instance with the updated title after each deployment switch. In which case Toolbox redraws the main
screen when page state changes.
I tested the workaround and indeed it works but with a caveat. The new env page is refreshed only when
Toolbox window page is made visible or when navigating from main env page to a single env page and then
back to the main page. For some reason, if we call `envPageManager.showPluginEnvironmentsPage()`` from the
authentication page displayed in `getOverrideUiPage() it doesn't trigger the new env refresh giving the
false impression that the URL won't change. In fact this was the reason why I missed this workaround in previously.
It is interesting that if I first navigate to a blank page - `toolboxUi.showUiPage(emptyPage)` - and then
immediately call `envPageManager.showPluginEnvironmentsPage()`, doing this rapid sequence seems to do the
trick without any visible artifacts (it happens so fast that we can't see the blank page being rendered)
- resolves #661 parent fcb9dc7 commit 3fd0c16
File tree
3 files changed
+11
-2
lines changed- src/main/kotlin/com/coder/toolbox
- views
3 files changed
+11
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
| 10 | + | |
11 | 11 | | |
12 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| 12 | + | |
12 | 13 | | |
13 | 14 | | |
14 | 15 | | |
| |||
340 | 341 | | |
341 | 342 | | |
342 | 343 | | |
| 344 | + | |
343 | 345 | | |
| 346 | + | |
344 | 347 | | |
345 | 348 | | |
346 | 349 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
56 | 60 | | |
57 | 61 | | |
58 | 62 | | |
| |||
0 commit comments