Allow a user to un-select a star
authorCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 22:26:50 +0000 (15:26 -0700)
committerCarl Worth <cworth@cworth.org>
Mon, 29 Jun 2020 22:26:50 +0000 (15:26 -0700)
By doing the intuitive thing and clicking it again.

empathy/empathy.jsx

index dc13edf5063ad403d4ffca275fedb86b7b39ccca..4ef6807fef559834be1fed0be1a6f9cb2f2ed889 100644 (file)
@@ -730,9 +730,15 @@ class Ambiguities extends React.PureComponent {
                           }
                 onClick={(event) => {
                   event.stopPropagation();
-                  this.setState({
-                    starred: set
-                  });
+                  if (this.state.starred === set) {
+                    this.setState({
+                      starred: null
+                    });
+                  } else {
+                    this.setState({
+                      starred: set
+                    });
+                  }
                 }}
               >
               {this.state.starred === set ?