is it possible to have a Repeater in action form in a loop

I should go to sleep but I wont till resolve this 😅 in a lw component with loops for items and each item with an action :
{{ ($this->settings)(['item' => $id]) }}
{{ ($this->settings)(['item' => $id]) }}
in that action I have a form with repeater
->fillForm(function (array $arguments) {
$client = $this->client();
$getIndex = $client->getIndex($arguments['index']);
$settings = $getIndex->getSettings();

$filterableAttributes[$arguments['index'].'-filterableAttributes'] = $settings['filterableAttributes'];
return $filterableAttributes;
})
->form(function (array $arguments) {
return [
Repeater::make('filterableAttributes')
->simple(TextInput::make('filterableAttributes'))
->grid(2)
->statePath($arguments['index'].'-filterableAttributes')
->key($arguments['index'].'-filterableAttsssributes')
];

})
->fillForm(function (array $arguments) {
$client = $this->client();
$getIndex = $client->getIndex($arguments['index']);
$settings = $getIndex->getSettings();

$filterableAttributes[$arguments['index'].'-filterableAttributes'] = $settings['filterableAttributes'];
return $filterableAttributes;
})
->form(function (array $arguments) {
return [
Repeater::make('filterableAttributes')
->simple(TextInput::make('filterableAttributes'))
->grid(2)
->statePath($arguments['index'].'-filterableAttributes')
->key($arguments['index'].'-filterableAttsssributes')
];

})
it looks like any sup request will lose all the data in $arguments
Solution:
NOW I CAN SLEEEEEEP 😂
Jump to solution
12 Replies
awcodes
awcodes13mo ago
Not quite following, but you’re passing ‘item’ and checking against ‘index’ in the args array. Is that right? Shouldn’t it also be $this->settingsAction Need to see more code. The pieces aren’t fitting together in my head from what you provided.
Lara Zeus
Lara ZeusOP13mo ago
ya I cleaned up some codes 🙂 changed a lot of things since I start writing the post but yes the action is {{ ($this->indexSettingsAction)(['index' => $index->getUid()]) }} and worked fine and its available in ->fillForm(function (array $arguments) and ->form(function (array $arguments) but after any new ajax request (press add item in a repeater) the $arguments is null let me test with text input to check...
awcodes
awcodes13mo ago
I think there’s a bug about this on GitHub too. See if this works as a temp solution. $arguments = Arr::first($livewire->mountedFormComponentActionsArguments);
Lara Zeus
Lara ZeusOP13mo ago
Lara Zeus
Lara ZeusOP13mo ago
will check now nop it return null
awcodes
awcodes13mo ago
Hmm. Not sure then. Had to do that in Tiptap editor, for the same reason. I think it stems from the modal dispatching custom events on open and close which resets the arguments but haven’t been able to fully test.
Lara Zeus
Lara ZeusOP13mo ago
will digg into it more thanks adam
awcodes
awcodes13mo ago
Go to bed. Dig tomorrow.
Lara Zeus
Lara ZeusOP13mo ago
I should hehe
Solution
Lara Zeus
Lara Zeus13mo ago
NOW I CAN SLEEEEEEP 😂
Lara Zeus
Lara ZeusOP13mo ago
I get the arguments from $arguments = Arr::last($livewire->mountedActionsArguments);
Lara Zeus
Lara ZeusOP13mo ago
GitHub
arguments passed to action modal content missing · Issue #8763 · fi...
Package filament/filament Package Version 3.0.62 Laravel Version 10.25.1 Livewire Version 3.0.5 PHP Version 8.1.23 Problem description when passing action arguments to modal content view it become ...
Want results from more Discord servers?
Add your server