Skip to content

Commit

Permalink
removed include
Browse files Browse the repository at this point in the history
  • Loading branch information
Oleksandr Holub committed Dec 28, 2023
1 parent 3a5e60d commit ad12c1f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const TopTagsList = observer(() => {
show more
</button>
)}
{ showAll && (
{ showAll && sortedTags.length > MaxTagsShown && (
<button onClick={() => setShowAll(false)} className="py-1 font-semibold text-zinc-500 hover:text-zinc-300">
show less
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ public async Task<GetLinkListResponse> Handle(GetLinkListRequest request, Cancel
}

var query = context.Links
.AsNoTracking()
.Include(x => x.Tags)
.FilterByTags(request.Tags)
.FilterByTitle(request.Title)
.FilterLiked(request.Liked, userId)
Expand All @@ -46,12 +44,13 @@ public async Task<GetLinkListResponse> Handle(GetLinkListRequest request, Cancel
BelongsToUser = userId != null && userId == x.UserId,
Editable = userId != null && userId == x.UserId
})
.AsNoTracking()
.PaginatedListAsync(request.PageNumber, request.PageSize);
var tags = await query
.Include(x => x.Tags).ThenInclude(x => x.Links)
.SelectMany(x => x.Tags)
.GroupBy(x => x.Name)
.Select(x => new TagDto(x.Key, x.Count()))
.AsNoTracking()
.ToArrayAsync(cancellationToken);

return new GetLinkListResponse(links, tags);
Expand Down

0 comments on commit ad12c1f

Please sign in to comment.