F
Filamentβ€’2w ago
hitech95

Filament not calling reorder action (repeater) on drag&drop

I have a form with a repeater. The repeater reorder is working fine by using the moveUp/moveDown actions but the reorder action fails. MountableAction->call is not called. Looks like that we are failing on the HasFormComponentAction->getMountedFormComponentActionComponent() is returning null. The ComponentKey is incorrectly filled with "data.myRepeaterPath" instead of the component key specified manually. The issue seems to come from: https://github.com/filamentphp/filament/blob/3.x/packages/forms/resources/views/components/repeater/index.blade.php#L75 How to properly solve the issue?
GitHub
filament/packages/forms/resources/views/components/repeater/index.b...
A powerful open source UI framework for Laravel β€’ Build and ship admin panels & apps fast with Livewire - filamentphp/filament
12 Replies
hitech95
hitech95OPβ€’2w ago
up
Dennis Koch
Dennis Kochβ€’2w ago
Can you share some of your code? It's hard to follow.
hitech95
hitech95OPβ€’2w ago

function form(Form $form): Form
{
return $form
->schema([
Repeater::make('repositoryDocuments')
->key('automaticDocuments') // Using key breaks drag & drop, arrows buttons work ok
->relationship()
->addable(false)
->reorderable(true)
->hiddenLabel(true)
->orderColumn('Position')
->schema([
Hidden::make('Repository_ID'),
...
]),
]);
}

function form(Form $form): Form
{
return $form
->schema([
Repeater::make('repositoryDocuments')
->key('automaticDocuments') // Using key breaks drag & drop, arrows buttons work ok
->relationship()
->addable(false)
->reorderable(true)
->hiddenLabel(true)
->orderColumn('Position')
->schema([
Hidden::make('Repository_ID'),
...
]),
]);
}
the XHR call to livewire/update have the path repositoryDocuments instead of automaticDocuments failing to extract the correct component to perform the action into.
Dennis Koch
Dennis Kochβ€’2w ago
What's the reason you can't use Repeater::make('automaticDocuments')?
hitech95
hitech95OPβ€’2w ago
I'm accessing the component to update it from other fields.
hitech95
hitech95OPβ€’2w ago
similar to: https://filamentphp.com/docs/3.x/forms/advanced#dynamic-fields-based-on-a-select-option as this is a a ->relationship() I have multiple repeaters with different keys on the same relation to identify the "condition" of the relationship.
Dennis Koch
Dennis Kochβ€’2w ago
So you have an extra query on for the relationship? Otherwise it would just load the same for all repeaters, right? Might be a bug then
hitech95
hitech95OPβ€’2w ago
yea I have simplified the example. the issue seems to be caused by the blade file as it uses the statepath instead of the key. on v4 you are using the key for what I've seen.
Dennis Koch
Dennis Kochβ€’2w ago
Can you try ->statePath('automaticDocuments') instead of the key? Not sure if the ->key() is meant to be used for that.
hitech95
hitech95OPβ€’2w ago
going to try, but then why the buttons perform the XHR call correctly with the key (mountFormComponentAction ) meanwhile the D&D does not intend to use the $key?
Dennis Koch
Dennis Kochβ€’2w ago
I have no idea. Could be a bug. Too much in my head right now to have a deeper look. Sorry.
hitech95
hitech95OPβ€’2w ago
NP πŸ™‚ if you have a minute to spare can you take a look to my other question? (maybe you have a tip to do easily without forcing livewire to re-render the component forcefully by changing the key)

Did you find this page helpful?