fix(tui): prevent race condition where progress messages override summary screen
- commit
- ac700d5ce90a5f6e2f427e42a11df1fb95714e43
- author
- brice · · 2026-01-25 18:16 UTC
- parent
- 253778f
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +11 -2
M internal/interfaces/tui/app.go +4 -1
| @@ -214,7 +214,10 @@ func (a *App) handleFormInput(msg tea.KeyMsg) (tea.Model, tea.Cmd) { | |||
| 214 | 214 | func (a *App) handleProgressUpdate(msg handlers.ProgressUpdateMsg) (tea.Model, tea.Cmd) { | |
| 215 | 215 | updatedProgress, cmd := handlers.HandleProgressUpdate(a, msg, a.progressModel) | |
| 216 | 216 | a.progressModel = updatedProgress | |
| 217 | - | a.currentScreen = ScreenProgress | |
| 217 | + | // Don't override summary or error screens with late progress messages | |
| 218 | + | if a.currentScreen != ScreenSummary && a.currentScreen != ScreenError { | |
| 219 | + | a.currentScreen = ScreenProgress | |
| 220 | + | } | |
| 218 | 221 | return a, cmd | |
| 219 | 222 | } | |
| 220 | 223 | ||
| @@ -214,7 +214,10 @@ func (a *App) handleFormInput(msg tea.KeyMsg) (tea.Model, tea.Cmd) { | |||||
| 214 | func (a *App) handleProgressUpdate(msg handlers.ProgressUpdateMsg) (tea.Model, tea.Cmd) { | 214 | func (a *App) handleProgressUpdate(msg handlers.ProgressUpdateMsg) (tea.Model, tea.Cmd) { | ||
| 215 | updatedProgress, cmd := handlers.HandleProgressUpdate(a, msg, a.progressModel) | 215 | updatedProgress, cmd := handlers.HandleProgressUpdate(a, msg, a.progressModel) | ||
| 216 | a.progressModel = updatedProgress | 216 | a.progressModel = updatedProgress | ||
| 217 | - | a.currentScreen = ScreenProgress | 217 | + | // Don't override summary or error screens with late progress messages |
| 218 | + | if a.currentScreen != ScreenSummary && a.currentScreen != ScreenError { | |||
| 219 | + | a.currentScreen = ScreenProgress | |||
| 220 | + | } | |||
| 218 | return a, cmd | 221 | return a, cmd | ||
| 219 | } | 222 | } | ||
| 220 | 223 | ||||
M internal/interfaces/tui/views/summary_view.go +7 -1
| @@ -60,9 +60,15 @@ func RenderSummary(im *models.InstallationModelImpl) string { | |||
| 60 | 60 | } | |
| 61 | 61 | ||
| 62 | 62 | b.WriteString("\n") | |
| 63 | + | b.WriteString(lipgloss.NewStyle(). | |
| 64 | + | Bold(true). | |
| 65 | + | Foreground(lipgloss.Color("14")). | |
| 66 | + | Render("You can now reboot into your new system!")) | |
| 67 | + | b.WriteString("\n\n") | |
| 68 | + | ||
| 63 | 69 | b.WriteString(lipgloss.NewStyle(). | |
| 64 | 70 | Faint(true). | |
| 65 | - | Render("Press 'q' to exit")) | |
| 71 | + | Render("Press 'q' to exit, then run: reboot")) | |
| 66 | 72 | ||
| 67 | 73 | return b.String() | |
| 68 | 74 | } | |
| @@ -60,9 +60,15 @@ func RenderSummary(im *models.InstallationModelImpl) string { | |||||
| 60 | } | 60 | } | ||
| 61 | 61 | ||||
| 62 | b.WriteString("\n") | 62 | b.WriteString("\n") | ||
| 63 | + | b.WriteString(lipgloss.NewStyle(). | |||
| 64 | + | Bold(true). | |||
| 65 | + | Foreground(lipgloss.Color("14")). | |||
| 66 | + | Render("You can now reboot into your new system!")) | |||
| 67 | + | b.WriteString("\n\n") | |||
| 68 | + | ||||
| 63 | b.WriteString(lipgloss.NewStyle(). | 69 | b.WriteString(lipgloss.NewStyle(). | ||
| 64 | Faint(true). | 70 | Faint(true). | ||
| 65 | - | Render("Press 'q' to exit")) | 71 | + | Render("Press 'q' to exit, then run: reboot")) |
| 66 | 72 | ||||
| 67 | return b.String() | 73 | return b.String() | ||
| 68 | } | 74 | } | ||