TagsInput is not rendering when used inside a function

while editing resource iam able to get the tag input but while creating its not rendering
5 Replies
Patrick Boivin
Looks like you are creating fields dynamically?
GHOST-117
GHOST-117OP2y ago
Yes
Patrick Boivin
I'm not sure but I seem to remember seeing a similar discussion recently. You may need to initialize each dynamic field manually:
$set($field, null);
$set($field, null);
GHOST-117
GHOST-117OP2y ago
can u give a small example or any doc or any thing i can refer to
Patrick Boivin
This is untested, but I think you would need something like this on every field generated dynamically:
->afterStateHydrated(function ($state, $set) {
if ($state) {
return;
}

$set('field_name', null);
})
->afterStateHydrated(function ($state, $set) {
if ($state) {
return;
}

$set('field_name', null);
})
Maybe there's a better way... I've never really had to do this.
Want results from more Discord servers?
Add your server