Perhaps Trump genuinely believed giving dialogue a chance was worth a try.
Discussion with Iran was expected to end in a failure, but we are never safe from a surprise and even there is 90% risk for things to turn a certain way, it also means there is 10% chance they can turn another.
So, wether he believed in that 10% or not, he apparently believed it was a worth a try.
That being said and out of the way, if anything, now he knows Iran can't be reasoned with and hopefully he will take the appropriate approach.
On a more interesting topic:
The targets were located at the Bandar Abbas naval base and Corsair drones were used.