When you have a layover without leaving the airport and your luggage goes straight through, you generally don't need a visa because you're in the international transit zone. What most people don't mention is that it's worth downloading the FlyDubai app or checking the Dubai airport authority's website before your flight, because sometimes they offer a free 96-hour "transit visa" if you want to go out and explore, and it's good to know you have that option if your layover gets longer. Either way, with 8 hours and a terminal change (which sometimes happens), the safest thing is to stay in the transit zone and not complicate things, but make sure your passport is valid for at least 6 more months beyond your trip.