Specifically:
|
// Load book slugs onto these models by default during query-time |
|
static::addGlobalScope('book_slug', function (Builder $builder) { |
|
$builder->addSelect(['book_slug' => function ($builder) { |
|
$builder->select('slug') |
|
->from('books') |
|
->whereColumn('books.id', '=', 'book_id'); |
|
}]); |
|
}); |
The addSelect, where no current selection exists, auto selects all columns.
This is leading to way too much data being loaded in where we're trying to be selective, like almost any loading of pages/chapters for lists.
Need to ideally make this select work with others, or otherwise find another route for this.
Will require attention to be payed to what fields are being returned in API responses, as this could now potentially be a backward compatibility break. Relevant to all endpoints showing chapters/pages, maybe including those on parent items (books->show).
Specifically:
BookStack/app/Entities/Models/BookChild.php
Lines 25 to 32 in 16af833
The
addSelect, where no current selection exists, auto selects all columns.This is leading to way too much data being loaded in where we're trying to be selective, like almost any loading of pages/chapters for lists.
Need to ideally make this select work with others, or otherwise find another route for this.
Will require attention to be payed to what fields are being returned in API responses, as this could now potentially be a backward compatibility break. Relevant to all endpoints showing chapters/pages, maybe including those on parent items (books->show).