Skip to content

Architecture ... #286

Answered by tonyhb
pheninux asked this question in Q&A
Apr 11, 2022 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

Hey Pheninux. I'm not sure if you've ever looked into Elm or React, but if so it might be similar. Typically, you want:

  1. A single top-level state manager. This would contain an enum which controls each view.
  2. Individual state structs for each view, embedded in the top-level state manager.

The top-level state manager is responsible for rendering all content. It delegates to each embedded state store to render components, etc. You have to pass down tea.Msg in Update() to all nested components.

RE. DB usage, you can either:

  1. Control DB outside of Tea via goroutines, and pass in messages using https://pkg.go.dev/github.com/charmbracelet/bubbletea?utm_source=godoc#Program.Send.
  2. Control DB usag…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@pheninux
Comment options

Answer selected by bashbunni
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants