Select in repeater - Slow loads when select relation has large record amount

Hey there, I'm using a repeater to fill out a many to many, however using the standard ->options(Entity::query()->pluck('name','id')) in the select slows the page down on load as there are 80k records in the entities table. The select didn't like having ->relationship('entity') on it as it was throwing an error of trying to get the property enitity on the entity model itself. Is there a way of having this be lazy whilst also working on an edit?
3 Replies
Alex Rowe
Alex RoweOP2y ago
I'm just conscious that when I am editing a collection with tens of entities, it's going to be proper slow, both query wise and the DOM
Dan Harrin
Dan Harrin2y ago
absolutely, getSearchResultsUsing() and getOptionLabelUsing() allow you to lazy-load options should be in the Select docs
Alex Rowe
Alex RoweOP2y ago
@danharrin Must have had my relationships messed up as nothing populated when I first used this, but now it's working like a charm! Thanks for the help
Want results from more Discord servers?
Add your server