It makes the template visibility toggle work the same as the other overlay toggles. The code for this looks rather ugly to me personally, but I reason that it's better to be consistent so that a later refactor can improve all of this at once.
It soft reverts #671 with a lengthy note explaining why that change causes this bug. The summary is that the function used there to update the query string causes a feedback loop to the template under certain conditions on a 200ms delay. This is what caused the template to show up again if it was quickly toggled on and off again.
This does two things:
It makes the template visibility toggle work the same as the other overlay toggles. The code for this looks rather ugly to me personally, but I reason that it's better to be consistent so that a later refactor can improve all of this at once.
It soft reverts #671 with a lengthy note explaining why that change causes this bug. The summary is that the function used there to update the query string causes a feedback loop to the template under certain conditions on a 200ms delay. This is what caused the template to show up again if it was quickly toggled on and off again.