From 083a895be2d886571b5ae9b9ed5b23fc40e954ec Mon Sep 17 00:00:00 2001 From: tolelom <98kimsungmin@naver.com> Date: Wed, 25 Mar 2026 14:01:55 +0900 Subject: [PATCH] fix: address review issues in screen extraction Co-Authored-By: Claude Sonnet 4.6 --- ui/class_view.go | 2 +- ui/model.go | 10 ---------- ui/nickname_view.go | 5 ++++- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/ui/class_view.go b/ui/class_view.go index d47feae..8b5c801 100644 --- a/ui/class_view.go +++ b/ui/class_view.go @@ -48,7 +48,7 @@ func (s *ClassSelectScreen) Update(msg tea.Msg, ctx *Context) (Screen, tea.Cmd) ctx.Lobby.StartRoom(ctx.RoomCode) gs := NewGameScreen() gs.gameState = ctx.Session.GetState() - return gs, nil + return gs, gs.pollState() } } } diff --git a/ui/model.go b/ui/model.go index 815e5d7..479e554 100644 --- a/ui/model.go +++ b/ui/model.go @@ -8,11 +8,6 @@ import ( "github.com/tolelom/catacombs/store" ) -// StateUpdateMsg is sent by GameSession to update the view -type StateUpdateMsg struct { - State game.GameState -} - type tickMsg struct{} type Model struct { @@ -66,11 +61,6 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.ctx.Height = 24 } return m, nil - case StateUpdateMsg: - if gs, ok := m.currentScreen.(*GameScreen); ok { - gs.gameState = msg.State - } - return m, nil } next, cmd := m.currentScreen.Update(msg, m.ctx) diff --git a/ui/nickname_view.go b/ui/nickname_view.go index c24aa44..0a61552 100644 --- a/ui/nickname_view.go +++ b/ui/nickname_view.go @@ -2,6 +2,7 @@ package ui import ( "fmt" + "log/slog" "strings" tea "github.com/charmbracelet/bubbletea" @@ -22,7 +23,9 @@ func (s *NicknameScreen) Update(msg tea.Msg, ctx *Context) (Screen, tea.Cmd) { if isEnter(key) && len(s.input) > 0 { ctx.PlayerName = s.input if ctx.Store != nil && ctx.Fingerprint != "" { - ctx.Store.SaveProfile(ctx.Fingerprint, ctx.PlayerName) + if err := ctx.Store.SaveProfile(ctx.Fingerprint, ctx.PlayerName); err != nil { + slog.Error("failed to save profile", "error", err) + } } if ctx.Lobby != nil { ctx.Lobby.PlayerOnline(ctx.Fingerprint, ctx.PlayerName)