I'm working on a Blazor Server-Side application. The NavBar on the left as anyone familiar with Blazor is populated with hyperlinks, just decorated with a special css class. My problem is, I'm trying to stop navigation and show a pop-up on one specific page if anything has been edited.
I've tried using a handler from LocationChanged to catch it, but it doesn't fire the method off until after the url is already changed. I've tried using dbContext.ChangeTracker.HasChanges() in an if statement and then had a modal pop-up that asked if you wanted to save changes or navigate away, but I can't find a way to fire it off BEFORE the url changed. I've tried a nuget package called BlazorBeforeUnload to add an event handler that catches the redirect or routing before it happens, but it's written for .net standard 2.0, not .net core 3.0. I can write C# decently, but I'm not good enough to figure out how to convert it from one to the other, or to know if it's even possible in this case.
I expected to have some method of firing an event right before the page re-routes or refreshes, but I can't seem to find anything either in Visual Studio or elsewhere online aside from the .net standard 2.0 package that gives me build errors.