commit 4b61a99502304ee359a656612f0c96a5252e3469
parent 5f4e99bf4057f718a186e85aa9a0a01674b19c69
Author: Jack Mordaunt <jackmordaunt@gmail.com>
Date: Sat, 27 Feb 2021 20:05:54 +0800
fix: reload projects after creating a new one
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/cmd/kanban/ui.go b/cmd/kanban/ui.go
@@ -180,13 +180,17 @@ func (ui *UI) Update(gtx C) {
{Name: "Done"},
},
}
+ // @cleanup
+ // Could we enforce this relationship with the api?
+ // Perhaps pass in the projects slice and have it append to it.
if err := ui.Storage.Create(p); err != nil {
log.Printf("creating new project: %v", err)
} else {
- // Note: the Storer interface only updates the projects
- // in the slice given to it. Therefore we add the Project
- // to the slice here. @cleanup
- ui.Projects = append(ui.Projects, p)
+ if projects, err := ui.Storage.List(); err == nil {
+ ui.Projects = projects
+ } else {
+ log.Printf("listing projects: %v", err)
+ }
}
ui.Clear()
}