Slug causing error if it cant catch up to the product name

Hello guyss, Im getting an error and I think the one that causing it is the slug When I type so fast on the product-name and the slug cant catch up it will return an error. my code
TextInput::make('name')
->reactive()
->required()
->afterStateHydrated(function (TextInput $component, $state) {
$component->state(ucwords($state));
})
->afterStateUpdated(function (Closure $set, $state) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')
->disabled()
->required(),
TextInput::make('name')
->reactive()
->required()
->afterStateHydrated(function (TextInput $component, $state) {
$component->state(ucwords($state));
})
->afterStateUpdated(function (Closure $set, $state) {
$set('slug', Str::slug($state));
}),
TextInput::make('slug')
->disabled()
->required(),
1 Reply
Yuut4
Yuut417mo ago
oops I don't know if it will help but try for ->lazy()
Want results from more Discord servers?
Add your server