Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:47:21

Obedience and good words. And when the matter ˹of fighting˺ was determined, if they had been true to Allah, it would have been better for them.  

would be ˹to offer˺ obedience and honourable words, that is, ˹words˺ that are kind to you. Then, when the matter has been resolved upon, that is to say, ˹when˺ fighting has been prescribed, if they are loyal to God, in faith and obedience, it will be better for them (the sentence beginning with law, ‘if’, constitutes the response to idhā, ‘when’).
القرآن:٤٧:٢١

طَاعَةٌ وَقَوْلٌ مَعْرُوفٌ ۚ فَإِذَا عَزَمَ الْأَمْرُ فَلَوْ صَدَقُوا اللَّهَ لَكَانَ خَيْرًا لَهُمْ  

{طاعة وقول معروف} أي حسن لك {فإذا عزم الأمر} أي فرض القتال {فلو صدقوا الله} في الإيمان والطاعة {لكان خيرا لهم} وجملة لو جواب إذا.