As reported in #4631 there are 2 ways to unintentionally select all units of some type after placing a foundation with a doubleclick.
This can be really bad in case we wanted to delete the foundation right afterwards and then accidentally deleted all units of some type.
A second bug: if you click on the unit and give it a preselected action (repair, patrol, guard) and double click as you perform the preselected action, you will see the same bug. The core problem is that clickedEntity is associated with a click event and any double or triple clicks that follow it, but is being retained for the next click event. It's supposed to get reset but that only happens if the next single click event's inputState is INPUT_NORMAL