fix(ui): reopen order form if menu already loaded on 'n' instead of refetching
- If menu is cached, build and init form immediately - Otherwise, show loading status and fetch menu from server
This commit is contained in:
parent
b94670f138
commit
616017267e
4
main.go
4
main.go
@ -212,6 +212,10 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
|||||||
return m, nil
|
return m, nil
|
||||||
}
|
}
|
||||||
m.err = nil
|
m.err = nil
|
||||||
|
if len(m.menu) > 0 {
|
||||||
|
m.form = m.buildForm()
|
||||||
|
return m, m.form.Init()
|
||||||
|
}
|
||||||
m.loading = true
|
m.loading = true
|
||||||
m.status = "Loading menu..."
|
m.status = "Loading menu..."
|
||||||
return m, fetchMenuCmd(m.conn)
|
return m, fetchMenuCmd(m.conn)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user