diff --git a/examples/chat/pages/chat.$id.go b/examples/chat/pages/chat.$id.go index f38baab..70e7fd4 100644 --- a/examples/chat/pages/chat.$id.go +++ b/examples/chat/pages/chat.$id.go @@ -76,8 +76,11 @@ func ChatRoom(ctx *h.RequestContext) *h.Page { ) } -var CachedRoomHeader = h.CachedT(time.Hour, func(ctx *h.RequestContext) *h.Element { - return roomNameHeader(ctx) +var CachedRoomHeader = h.CachedPerKeyT(time.Hour, func(ctx *h.RequestContext) (string, h.GetElementFunc) { + roomId := chi.URLParam(ctx.Request, "id") + return roomId, func() *h.Element { + return roomNameHeader(ctx) + } }) func roomNameHeader(ctx *h.RequestContext) *h.Element {