Fix W3-T1 review: forward CancellationToken in GetPaged, scrub ex.Message from snackbar, drop unused Navigation inject, annotate ITrackService wiring in CmsStartup

This commit is contained in:
Daniel Harvey
2026-05-18 14:58:36 -04:00
parent 77e6637a9e
commit 88c94b24cf
6 changed files with 16 additions and 9 deletions
@@ -24,12 +24,12 @@ public class TrackRepository
return await _db.Tracks.ToListAsync();
}
public async Task<PagedResult<TrackEntity>> GetPage(PagingParameters<TrackEntity> pageParameters)
public async Task<PagedResult<TrackEntity>> GetPage(PagingParameters<TrackEntity> pageParameters, CancellationToken cancellationToken = default)
{
// Two separate queries with no transaction: count and page can be momentarily inconsistent
// under concurrent writes. Acceptable — write volume is low and the UI is read-only.
// If filtering is added, the count query must be updated to apply the same filter.
var count = await _db.Tracks.CountAsync();
var count = await _db.Tracks.CountAsync(cancellationToken);
var orderBy = pageParameters.OrderBy ?? (t => t.Id);
var ordered = pageParameters.IsDescending
@@ -39,7 +39,7 @@ public class TrackRepository
var page = await ordered
.Skip(pageParameters.Skip)
.Take(pageParameters.PageSize)
.ToListAsync();
.ToListAsync(cancellationToken);
return new PagedResult<TrackEntity>(page, count, pageParameters.Page, pageParameters.PageSize);
}