Menu not removing filter

I have a link that takes me to a page with the results filtered, works great

Now if I want to go to the unfiltered page, I click the menu and the URL changes as expected, but the results on the page are still filtered.

I have to reload the page to show the unfiltered data.

The menu should work, any ideas?

The menu is not the problem here - most probably the code that filters your data in the page is not executed on second visit. You can debug your app to check this.

1 Like

If you are performing the filtering in OnInitialized or OnInitializedAsync then it won't be executed by navigating to the same page. This is how the Blazor lifecycle works - those methods are called only once. You can try using a different method such as OnParametersSet or OnParametersSetAsync.

1 Like

this fixed it, thank you!

This isn't working after all.

This is the filtered list, works great:

Here is my code:

When I go to the loads page from the menu, it doesn't do anything at all, it never hit's the breakpoints, the URL changes to just /loads per the menu, but nothing happens at all (except for the URL change).

Local tests show that OnParametersSetAsync is called in such cases. Not sure why it doesn't work for you (and why it worked initially). All that I know is that this is how Blazor routing works - if the route changes to the same component it doesn't call OnInitializedAsync again.

my logic was wrong, had wrong code in wrong place. your answer helped me, thank you.