If a child has a dirty diaper and you notice they have pooped in their diaper you should change it within 5 or 10 minutes of noticing.
Poop in diapers can lead to a serious rash if not changed quickly enough.
I always waited a minimum of 10 minutes before changing my kids dirty poop diapers because if I changed it right after they got done pooping they would poop in the new diaper soon after.
So I would let them know that I would be changing their diaper soon and while I waited I would gather the supplies such as a new diaper, wipes, changing pad etc.
Then I would change their poop diaper.
There have been times they pooped during the night though and I would wait until morning to change the poop diaper and it never bothered them.
Or we would be on road trips and there would be nowhere to stop for at least 30 minutes to an hour so they would have to sit in the poop diaper for that long.