diff --git a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs index f9ea5160b..0888a3f0d 100644 --- a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs @@ -14,6 +14,7 @@ namespace Prism.Navigation; public class PageNavigationService : INavigationService, IRegistryAware { private static readonly SemaphoreSlim _semaphore = new (1, 1); + private static readonly TimeSpan _minTimeBetweenNavigations = TimeSpan.FromMilliseconds(150); private static DateTime _lastNavigate; internal const string RemovePageRelativePath = "../"; internal const string RemovePageInstruction = "__RemovePage/"; @@ -414,9 +415,10 @@ private static async Task WaitForPendingNavigationRequests() { await _semaphore.WaitAsync(); // Ensure adequate time has passed since last navigation so that UI Refresh can Occur - if (DateTime.Now - _lastNavigate < TimeSpan.FromMilliseconds(150)) + TimeSpan timeSinceLastNav = DateTime.Now - _lastNavigate; + if (timeSinceLastNav < _minTimeBetweenNavigations) { - await Task.Delay(150); + await Task.Delay(_minTimeBetweenNavigations - timeSinceLastNav); } }