1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-07-30 04:23:11 +03:00

Improved relation loading during search

Relations now loaded during back-end query phase instead of being lazy
loaded one-by-one within views.

Reduced queries in testing from ~60 to ~20.

Need to check other areas list-item.php's "showPath" option is used to
ensure relations are properly loaded for those listings.
This commit is contained in:
Dan Brown
2021-11-08 15:24:49 +00:00
parent b3e1c7da73
commit bc472ca2d7
2 changed files with 37 additions and 17 deletions

View File

@ -3,9 +3,9 @@
<div class="entity-item-snippet">
@if($showPath ?? false)
@if($entity->book_id)
@if($entity->relationLoaded('book') && $entity->book)
<span class="text-book">{{ $entity->book->getShortName(42) }}</span>
@if($entity->chapter_id)
@if($entity->relationLoaded('chapter') && $entity->chapter)
<span class="text-muted entity-list-item-path-sep">@icon('chevron-right')</span> <span class="text-chapter">{{ $entity->chapter->getShortName(42) }}</span>
@endif
@endif