Skip to content

Commit 094dbbe

Browse files
committed
remove sendasyncinitiation from docs
1 parent 9db6f91 commit 094dbbe

1 file changed

Lines changed: 0 additions & 8 deletions

File tree

tsunami/prompts/system.md

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,6 @@ var App = app.DefineComponent("App", func(_ struct{}) any {
920920
- **Effects**: Always include proper dependency arrays to avoid infinite loops
921921
- **Cleanup**: Return cleanup functions from effects for timers, subscriptions, goroutines
922922
- **Refs**: Use app.UseRef for goroutine communication, app.UseVDomRef for DOM access
923-
- **Async Updates**: Call app.SendAsyncInitiation after updating atoms from goroutines
924923
- **Performance**: Don't overuse effects - most logic should be in event handlers
925924

926925
## Async Operations and Goroutines
@@ -942,7 +941,6 @@ var ClockComponent = app.DefineComponent("ClockComponent", func(_ struct{}) any
942941
// Update every second - automatically cleaned up on unmount
943942
app.UseTicker(time.Second, func() {
944943
currentTime.Set(time.Now().Format("15:04:05"))
945-
app.SendAsyncInitiation()
946944
}, []any{})
947945

948946
return vdom.H("div", map[string]any{
@@ -967,7 +965,6 @@ var ToastComponent = app.DefineComponent("ToastComponent", func(props ToastCompo
967965
// Auto-hide after specified duration - cancelled if component unmounts
968966
app.UseAfter(props.Duration, func() {
969967
visible.Set(false)
970-
app.SendAsyncInitiation()
971968
}, []any{props.Duration})
972969

973970
if !visible.Get() {
@@ -1003,7 +1000,6 @@ var DataPollerComponent = app.DefineComponent("DataPollerComponent", func(_ stru
10031000
return
10041001
case <-time.After(30 * time.Second):
10051002
status.Set("fetching")
1006-
app.SendAsyncInitiation()
10071003

10081004
// Complex async operation: fetch, process, validate
10091005
newData, err := fetchAndProcessData()
@@ -1016,7 +1012,6 @@ var DataPollerComponent = app.DefineComponent("DataPollerComponent", func(_ stru
10161012
})
10171013
status.Set("success")
10181014
}
1019-
app.SendAsyncInitiation()
10201015
}
10211016
}
10221017
}
@@ -1055,8 +1050,6 @@ pollData := func(ctx context.Context) {
10551050
}
10561051
```
10571052

1058-
**app.SendAsyncInitiation()**: Call this after updating atoms from goroutines to trigger UI re-renders. Don't call at high frequency - consider batching updates.
1059-
10601053
**Functional setters**: Always use atom.SetFn() when updating state from goroutines to avoid race conditions:
10611054

10621055
```go
@@ -1364,4 +1357,3 @@ Key points:
13641357
- Use app.UseAfter instead of time.AfterFunc for delayed operations
13651358
- Always respect ctx.Done() in app.UseGoRoutine functions to prevent goroutine leaks
13661359
- All timer and goroutine cleanup is handled automatically on component unmount or dependency changes
1367-
- Call app.SendAsyncInitiation after state updates to trigger re-rendering

0 commit comments

Comments
 (0)