diff --git a/lib/state_container.dart b/lib/state_container.dart index b9f15326..de638cbf 100644 --- a/lib/state_container.dart +++ b/lib/state_container.dart @@ -204,12 +204,12 @@ class StateContainer with ChangeNotifier { void renameNote(Note note, String newFileName) async { logEvent(Event.NoteRenamed); + var oldNotePath = note.filePath; + note.rename(newFileName); + return _opLock.synchronized(() async { Log.d("Got renameNote lock"); - var oldNotePath = note.filePath; - note.rename(newFileName); - _gitRepo.renameNote(oldNotePath, note.filePath).then((NoteRepoResult _) { _syncNotes(); appState.numChanges += 1;