From 42211439c98bf06b27fc7b4d673a1f7a8d9dbc7d Mon Sep 17 00:00:00 2001 From: Ryan Hamamura <58859899+ryanhamamura@users.noreply.github.com> Date: Mon, 2 Mar 2026 21:34:46 -1000 Subject: [PATCH] refactor: drop redundant WithSelectorID from SSE patches All templ components already have id attributes on their root elements, which PatchElementTempl uses automatically. --- features/c4game/handlers.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/features/c4game/handlers.go b/features/c4game/handlers.go index 8a8c309..e385bbb 100644 --- a/features/c4game/handlers.go +++ b/features/c4game/handlers.go @@ -144,7 +144,7 @@ func HandleGameEvents(store *connect4.Store, nc *nats.Conn, sm *scs.SessionManag if snapshot == nil { continue } - if err := sse.PatchElementTempl(chatcomponents.Chat(snapshot, chatCfg), datastar.WithSelectorID("c4-chat")); err != nil { + if err := sse.PatchElementTempl(chatcomponents.Chat(snapshot, chatCfg)); err != nil { return } } @@ -305,8 +305,8 @@ func HandleRematch(store *connect4.Store, sm *scs.SessionManager) http.HandlerFu func sendGameComponents(sse *datastar.ServerSentEventGenerator, gi *connect4.Instance, myColor int, room *chat.Room, chatCfg chatcomponents.Config) { g := gi.GetGame() - sse.PatchElementTempl(components.Board(g, myColor), datastar.WithSelectorID("c4-board")) //nolint:errcheck - sse.PatchElementTempl(components.StatusBanner(g, myColor), datastar.WithSelectorID("c4-status")) //nolint:errcheck - sse.PatchElementTempl(components.PlayerInfo(g, myColor), datastar.WithSelectorID("c4-players")) //nolint:errcheck - sse.PatchElementTempl(chatcomponents.Chat(room.Messages(), chatCfg), datastar.WithSelectorID("c4-chat")) //nolint:errcheck + sse.PatchElementTempl(components.Board(g, myColor)) //nolint:errcheck + sse.PatchElementTempl(components.StatusBanner(g, myColor)) //nolint:errcheck + sse.PatchElementTempl(components.PlayerInfo(g, myColor)) //nolint:errcheck + sse.PatchElementTempl(chatcomponents.Chat(room.Messages(), chatCfg)) //nolint:errcheck }