Don't change the state when initializing the Charm client

This was residue from an earlier version in the application when it opened
with a spinner rather than directly in the stash. It caused the pager to
lock up and it's status bar to disappear if a local markdown file was
opened before the Charm client initialized.
This commit is contained in:
Christian Rocha 2020-07-20 14:03:27 -04:00 committed by Christian Muehlhaeuser
parent 2c71185ba6
commit 83eec3f833

View file

@ -70,6 +70,15 @@ const (
stateShowDocument
)
// String translates the staus to a human-readable string. This is just for
// debugging.
func (s state) String() string {
return [...]string{
"showing stash",
"showing document",
}[s]
}
type keygenState int
const (
@ -78,18 +87,6 @@ const (
keygenFinished
)
// String translates the staus to a human-readable string. This is just for
// debugging.
func (s state) String() string {
return [...]string{
"initializing",
"running keygen",
"keygen finished",
"showing stash",
"showing document",
}[s]
}
type model struct {
cc *charm.Client
user *charm.User
@ -267,7 +264,6 @@ func update(msg tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
case newCharmClientMsg:
m.cc = msg
m.state = stateShowStash
m.stash.cc = msg
m.pager.cc = msg
cmds = append(cmds, loadStash(m.stash), loadNews(m.stash))