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:
Syahdan 2025-10-15 22:33:31 +07:00
parent b94670f138
commit 616017267e

View File

@ -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)