Blazor WASM AutoQueryGrid Issues two requests on load with saved preferences

I noticed that if a user adds a filter/sort to a grid and you browse off the page and back the AutoQueryGrid will issue two requests, the first as if there is no filter (or sort) and the second with the saved filter.

Also, it would be nice to have a setting to not save filters between page loads.

<AutoQueryGrid @ref="grid" Model="JobGrid"
               ConfigureQuery="(x) => ((JobsRequest)x).SearchTerm = searchTerm" 
    Apis="Apis.AutoQuery<JobsRequest>()" AllowSelection=false ShowPreferences=false>
      <Columns>
        <!-- Custom class -->
        <Column Field="(JobGrid x) => x.Id"></Column>
        <Column Field="(JobGrid x) => x.CustomerName" Title="Customer"></Column>
      </Columns>
 </AutoQueryGrid>

First query happens before localStorage is read which is requeried if it contains any filters.

You can call ClearFiltersAsync() on the AutoQueryGrid instance to clear filters or delete them on localStorage directly.

1 Like

Thanks @mythz I’ll look into that.

Just to point out that users are not necessarily very technical and they’ll add a filter and come back later to the page and have no idea what’s going on. That’s why I’d love an option to disable the feature instead of having to manually clear it. Just something to consider as it already happened to me yesterday with a user.