From 1219d22834ee2f9677422a38445c476e10285eb0 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Wed, 20 May 2020 16:27:19 -0400 Subject: [PATCH] Don't set a note if the note didn't actually change --- ui/pager.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/ui/pager.go b/ui/pager.go index 3209d5a..5cc8789 100644 --- a/ui/pager.go +++ b/ui/pager.go @@ -120,10 +120,14 @@ func pagerUpdate(msg boba.Msg, m pagerModel) (pagerModel, boba.Cmd) { m.state = pagerStateBrowse return m, nil case "enter": - m.currentDocument.Note = m.textInput.Value() // update optimistically + var cmd boba.Cmd + if m.textInput.Value() != m.currentDocument.Note { // don't update if the note didn't change + m.currentDocument.Note = m.textInput.Value() // update optimistically + cmd = saveDocumentNote(m.cc, m.currentDocument.ID, m.currentDocument.Note) + } m.state = pagerStateBrowse m.textInput.Reset() - return m, saveDocumentNote(m.cc, m.currentDocument.ID, m.currentDocument.Note) + return m, cmd } default: switch msg.String() {