Prevent select option re-rendering in SelectInput

Hi, I am using a SelectInput that looks something like this

Select::make('test')->options(Post::query()->get()->pluck('id, title')


I am using this in a Wizard and my problem is that I have about 6-7 selects that rely on DB queries. This causes issues anytime I go between pages in the Wizard and the form ends up becoming very slow because it runs the DB query for the select options if there is any kind of validation, live state update, or change in wizard step.

I would like to make it so that I only have to query the DB once for the select options, on page load.

I could store the select options in public variable on the Form and call the query only once, in the mount method, and passing the variable as the options parameter in the selects. but I was wondering if there was a different way to do this where I could tell the Select component to not re-run the options query after the initial page load.
Was this page helpful?