fix(ui): defer secure API call on library page to prevent 401 on server pre-rendering
This commit is contained in:
@@ -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,10 +508,13 @@
|
|||||||
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)
|
||||||
|
{
|
||||||
|
if (firstRender)
|
||||||
{
|
{
|
||||||
await LoadBooksAsync();
|
await LoadBooksAsync();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private async Task LoadBooksAsync()
|
private async Task LoadBooksAsync()
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user