Is there any way to not call the api the state is change?

Hi can someone help me how to fix this? The $this->fieldMappingOptions is an external api and I will get the data and make an array with key and value. Now my problem is that whenever I select in my repeater and add new repeater field it will fetch again the api. How do I fetch only once the api?
Forms\Components\Select::make('first_app_fields')
->required()
->options($this->fieldMappingOptions)
->disableOptionWhen(
fn (Get $get, string $value, mixed $state) => collect($get('../../custom_field_mapping'))
->pluck('first_app_fields')
->diff([$state])
->filter()
->contains($value)
)
->reactive(),
Forms\Components\Select::make('first_app_fields')
->required()
->options($this->fieldMappingOptions)
->disableOptionWhen(
fn (Get $get, string $value, mixed $state) => collect($get('../../custom_field_mapping'))
->pluck('first_app_fields')
->diff([$state])
->filter()
->contains($value)
)
->reactive(),
0 Replies
No replies yetBe the first to reply to this messageJoin