From 09ea4cd874a6004b607bb9f267f1f4226b5a7772 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 24 May 2019 14:26:03 -0700 Subject: [PATCH 1/3] Todoist now properly updates list items when Refresh() is called --- modules/todoist/widget.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/modules/todoist/widget.go b/modules/todoist/widget.go index 2a4ca8a1..1b1039c1 100644 --- a/modules/todoist/widget.go +++ b/modules/todoist/widget.go @@ -53,14 +53,16 @@ func (widget *Widget) ProjectAt(idx int) *Project { return widget.projects[idx] } -func (w *Widget) Refresh() { - if w.Disabled() || w.CurrentProject() == nil { - w.SetItemCount(0) +func (widget *Widget) Refresh() { + widget.loadProjects() + + if widget.Disabled() || widget.CurrentProject() == nil { + widget.SetItemCount(0) return } - w.SetItemCount(len(w.CurrentProject().tasks)) - w.display() + widget.SetItemCount(len(widget.CurrentProject().tasks)) + widget.display() } func (widget *Widget) HelpText() string { From dd4d85e3372871ab0a00fc518478141a4e7dce83 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 24 May 2019 14:26:38 -0700 Subject: [PATCH 2/3] Update CHANGELOG.md --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65b698c6..a7fa884f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### 🐞 Fixed + +* Todoist now properly updates list items when Refresh is called + ## v0.10.3 * Invalid glog dependency removed, by [@bosr](https://github.com/bosr) From b9fc08e0983ca33f4f3fc7ab76c354272e312269 Mon Sep 17 00:00:00 2001 From: Chris Cummer Date: Fri, 24 May 2019 14:27:29 -0700 Subject: [PATCH 3/3] Todoist only refreshes if it is not disabled and there is a current project --- modules/todoist/widget.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/todoist/widget.go b/modules/todoist/widget.go index 1b1039c1..9778eac7 100644 --- a/modules/todoist/widget.go +++ b/modules/todoist/widget.go @@ -54,13 +54,13 @@ func (widget *Widget) ProjectAt(idx int) *Project { } func (widget *Widget) Refresh() { - widget.loadProjects() - if widget.Disabled() || widget.CurrentProject() == nil { widget.SetItemCount(0) return } + widget.loadProjects() + widget.SetItemCount(len(widget.CurrentProject().tasks)) widget.display() }