We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Is your feature request related to a problem? Please describe. No.
Describe the solution you'd like
switch msg := msg.(type) { case tea.Cmd: return m, msg }
Describe alternatives you've considered N/A
Additional context I have a Cmd which produces other Cmds:
func (m *Model) Create(name string) tea.Cmd { return func() tea.Msg { if !isAlphaNumeric(name) { return tea.Println("Only alphanumeric characters are allowed.") } var game db.Game m.app.db.Where("name = ?", name).First(&game) if game.ID != 0 { return tea.Printf("Game %q already exists. Please choose another name.", name) } game = db.Game{ Name: name, } if err := m.app.db.Create(&game).Error; err != nil { slog.Error("Failed to create game", "err", err.Error()) } return tea.Printf("Game created!") } }
It will be cool it cmds can produce other cmds.
This is easily solvable via:
But as Msg == any it took me some time to understand why nothing is printed. What about adding this as default behavior?
The text was updated successfully, but these errors were encountered:
When I run into this concern. I return a message type that when handled in the Update creates the desired tea.Cmd
Update
tea.Cmd
Sorry, something went wrong.
No branches or pull requests
Is your feature request related to a problem? Please describe.
No.
Describe the solution you'd like
Describe alternatives you've considered
N/A
Additional context
I have a Cmd which produces other Cmds:
It will be cool it cmds can produce other cmds.
This is easily solvable via:
But as Msg == any it took me some time to understand why nothing is printed. What about adding this as default behavior?
The text was updated successfully, but these errors were encountered: