fix(ui/security): Enforce idempotent AI fetching, secure auth handler, and memory leak guards #45

Merged
mjasin merged 4 commits from fix/idempotent-ai-fetching into develop 2026-05-20 17:27:40 +00:00
2 changed files with 5 additions and 5 deletions
Showing only changes of commit 1f48d36d9c - Show all commits
@@ -122,14 +122,11 @@ public class KnowledgeService : IKnowledgeService
} }
catch (Exception) catch (Exception)
{ {
// Evict from active dictionary on hard exceptions to ensure system resiliency
_activeRequests.TryRemove(requestKey, out _); _activeRequests.TryRemove(requestKey, out _);
throw; throw;
} }
finally finally
{ {
// Once a task successfully finishes and persists to the Persistent Database Cache,
// we evict it from RAM (_activeRequests) since future hits will leverage the DB cache.
_activeRequests.TryRemove(requestKey, out _); _activeRequests.TryRemove(requestKey, out _);
} }
} }
@@ -508,9 +508,12 @@
private bool _isLoading = true; private bool _isLoading = true;
private List<LastReadBookDto>? _books; private List<LastReadBookDto>? _books;
protected override async Task OnInitializedAsync() protected override async Task OnAfterRenderAsync(bool firstRender)
{ {
await LoadBooksAsync(); if (firstRender)
{
await LoadBooksAsync();
}
} }
private async Task LoadBooksAsync() private async Task LoadBooksAsync()