fix(centralui): marshal Audit Log LocationChanged handler through InvokeAsync
Code-review follow-ups on the same-page drill-in fix (3f1c0e5):
- Wrap HandleLocationChanged's body in InvokeAsync — LocationChanged can
fire off the renderer's synchronization context.
- Document that a paramless /audit/log navigation intentionally preserves
the last applied filter (drill-ins always carry query params).
This commit is contained in:
@@ -66,14 +66,19 @@ public partial class AuditLogPage : IDisposable
|
||||
/// navigates to <c>/audit/log?executionId=…</c>). Reassigning
|
||||
/// <see cref="_currentFilter"/> to a fresh instance is what kicks the results
|
||||
/// grid into reloading; we also close the drawer so the operator sees the
|
||||
/// newly filtered grid, and call <see cref="ComponentBase.StateHasChanged"/>
|
||||
/// because this fires outside the normal render lifecycle.
|
||||
/// newly filtered grid. The body is marshalled through
|
||||
/// <see cref="ComponentBase.InvokeAsync(Action)"/> because
|
||||
/// <see cref="NavigationManager.LocationChanged"/> can fire off the renderer's
|
||||
/// synchronization context.
|
||||
/// </summary>
|
||||
private void HandleLocationChanged(object? sender, LocationChangedEventArgs e)
|
||||
{
|
||||
_ = InvokeAsync(() =>
|
||||
{
|
||||
ApplyQueryStringFilters();
|
||||
_drawerOpen = false;
|
||||
StateHasChanged();
|
||||
});
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@@ -86,6 +91,10 @@ public partial class AuditLogPage : IDisposable
|
||||
var uri = Navigation.ToAbsoluteUri(Navigation.Uri);
|
||||
var query = QueryHelpers.ParseQuery(uri.Query);
|
||||
|
||||
// A paramless navigation (e.g. clicking the "Audit Log" nav link while
|
||||
// already here) intentionally preserves the last applied filter rather
|
||||
// than clearing the grid: this method is a drill-in mechanism and every
|
||||
// drill-in carries query params. The operator clears via the filter bar.
|
||||
if (query.Count == 0)
|
||||
{
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user