Can't use SpatieTagsInput in a bulk action
robschmitt opened this issue · comments
I'm using SpatieTagsInput in a modal defined as a Bulk Action on my resource:
return $table
...
->bulkActions([
Tables\Actions\DeleteBulkAction::make(),
Tables\Actions\BulkAction::make('tag')
->form([
Forms\Components\TagsInput::make('tags1'),
Forms\Components\SpatieTagsInput::make('tags2'),
])
->action(function (Collection $records, array $data): void {
// $data contains only tags1, NOT tags2
}),
]);
The example above includes both the standard TagsInput (tags1) and the SpatieTagsInput (tags1). When the form is submitted ONLY the tags1 value is passed to the action method; tags2 is absent from the $data array.
I can get it to work (i.e. pass through the value for tags2) by commenting out the following line in the setUp
method of Forms/Components/SpatieTagsInput.php
:
$this->dehydrated(false);
I assume this is however needed for the normal operation of the plugin. Why am I prevented from using SpatieTagsInput in a bulk action?