todosapp: fix input selection issue on sync

Before this CL, if person A was editing a todo (or tag, or list
name) while person B commits an edit and the committed edit gets
synced, the sync would trigger a UI update, causing A's todo text
(or tag, or list name) to get selected - and A's next keystroke
would wipe any existing text.

NOTE(adam): I'm not 100% sure this CL fixes the issue, because
it's difficult or impossible to test with a single laptop. I'll
have to test it in the office with Bindu.

Change-Id: If473402d869c134a8a33b6036417305caa076114
diff --git a/browser/index.js b/browser/index.js
index 02af4f6..f964892 100644
--- a/browser/index.js
+++ b/browser/index.js
@@ -180,8 +180,8 @@
       addingTag: false
     };
   },
-  componentDidUpdate: function() {
-    if (this.state.addingTag) {
+  componentDidUpdate: function(prevProps, prevState) {
+    if (this.state.addingTag && !prevState.addingTag) {
       activateInput(this.getDOMNode().querySelector('#edittag-input'));
     }
   },
@@ -233,8 +233,8 @@
       editingText: false
     };
   },
-  componentDidUpdate: function() {
-    if (this.state.editingText) {
+  componentDidUpdate: function(prevProps, prevState) {
+    if (this.state.editingText && !prevState.editingText) {
       activateInput(this.getDOMNode().querySelector('#todo-input'));
     }
   },
@@ -329,8 +329,8 @@
       editingName: false
     };
   },
-  componentDidUpdate: function() {
-    if (this.state.editingName) {
+  componentDidUpdate: function(prevProps, prevState) {
+    if (this.state.editingName && !prevState.editingName) {
       activateInput(this.getDOMNode().querySelector('#list-name-input'));
     }
   },