Just keep dogs on a lead in public areas. It's not cruel as extending leads will give them plenty of leeway, yet they can still be reigned in when required. As an earlier poster stated, dogs are pack animals and in need of a controller, whether that be a canine pack leader or instead, a human, yet dogs will readily accept this arrangement.
And please don't take dogs out for their exercise at the height of this heatwave. They are as likely to become even more frazzled than us in conditions like these, so please restrict walkies to early morning or late evening until the weather breaks.