The World Federation One Stop Fiqh

Ruling 1429

If while a person is performing a recommended prayer a congregational prayer commences, in the event that he is not confident that if he completes the recommended prayer he will be able to join the congregational prayer, it is recommended that he abandon his prayer and join the congregational prayer even if it is to join it in the first rakʿah.