Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions examples/suspense/main.templ
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,15 @@ import (

func main() {
http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {
expectedSlots := 3

// Create a channel to send deferred component renders to the template.
data := make(chan SlotContents)
// Use a buffered channel so the goroutines can finish without being blocked.
data := make(chan SlotContents, expectedSlots)

// We know there are 3 slots, so start a WaitGroup.
// We know the number of slots, so start a WaitGroup.
var wg sync.WaitGroup
wg.Add(3)
wg.Add(expectedSlots)

// Start the async processes.
// Sidebar.
Expand Down
15 changes: 9 additions & 6 deletions examples/suspense/main_templ.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading