refactor: drop redundant WithSelectorID from SSE patches
All templ components already have id attributes on their root elements, which PatchElementTempl uses automatically.
This commit is contained in:
@@ -144,7 +144,7 @@ func HandleGameEvents(store *connect4.Store, nc *nats.Conn, sm *scs.SessionManag
|
|||||||
if snapshot == nil {
|
if snapshot == nil {
|
||||||
continue
|
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
|
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) {
|
func sendGameComponents(sse *datastar.ServerSentEventGenerator, gi *connect4.Instance, myColor int, room *chat.Room, chatCfg chatcomponents.Config) {
|
||||||
g := gi.GetGame()
|
g := gi.GetGame()
|
||||||
|
|
||||||
sse.PatchElementTempl(components.Board(g, myColor), datastar.WithSelectorID("c4-board")) //nolint:errcheck
|
sse.PatchElementTempl(components.Board(g, myColor)) //nolint:errcheck
|
||||||
sse.PatchElementTempl(components.StatusBanner(g, myColor), datastar.WithSelectorID("c4-status")) //nolint:errcheck
|
sse.PatchElementTempl(components.StatusBanner(g, myColor)) //nolint:errcheck
|
||||||
sse.PatchElementTempl(components.PlayerInfo(g, myColor), datastar.WithSelectorID("c4-players")) //nolint:errcheck
|
sse.PatchElementTempl(components.PlayerInfo(g, myColor)) //nolint:errcheck
|
||||||
sse.PatchElementTempl(chatcomponents.Chat(room.Messages(), chatCfg), datastar.WithSelectorID("c4-chat")) //nolint:errcheck
|
sse.PatchElementTempl(chatcomponents.Chat(room.Messages(), chatCfg)) //nolint:errcheck
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user