footerActions run when modal open and close

And both actions run when I click one of them. Even with out the ->schema section. This is in a Relationanager :
public function form(Form $form): Form
{
return $form->schema(static::formSchema());
}

public static function formSchema(): array
{
return [
Split::make([
Section::make()
->schema([
static::getContactInboxConversation(),
])
->footerActions([
Action::make('previous_action')
->action(logger('previous_action')),
Action::make('next_action')
->action(logger('next_action')),
])
->extraAttributes(['class'=>'no-padding'])
->id('reviewSection'),
])
];
}
public function form(Form $form): Form
{
return $form->schema(static::formSchema());
}

public static function formSchema(): array
{
return [
Split::make([
Section::make()
->schema([
static::getContactInboxConversation(),
])
->footerActions([
Action::make('previous_action')
->action(logger('previous_action')),
Action::make('next_action')
->action(logger('next_action')),
])
->extraAttributes(['class'=>'no-padding'])
->id('reviewSection'),
])
];
}
Solution:
You should pass an action or a closure to the action method
->action(fn () => logger('previous_action'))
->action(fn () => logger('previous_action'))
...
Jump to solution
12 Replies
ddoddsr
ddoddsrOP2w ago
bump Bump
toeknee
toeknee2w ago
try naming the section, makes shouldn't really be empty
ddoddsr
ddoddsrOP2w ago
Looking at the docs under section overview: You can also use a section without a header, which just wraps the components in a simple card:. and it shows an example of
use Filament\Forms\Components\Section;

Section::make()
->schema([
// ...
])
use Filament\Forms\Components\Section;

Section::make()
->schema([
// ...
])
but I did try adding unique names to the makes() in case the Split required named sections.
toeknee
toeknee2w ago
It won'\t make any difference but
public function form(Form $form): Form
{
return $form->schema(static::formSchema());
}

public static function formSchema(): array
{
return [
Split::make([
Section::make([
static::getContactInboxConversation(),
])
->footerActions([
Action::make('previous_action')
->action(logger('previous_action')),
Action::make('next_action')
->action(logger('next_action')),
])
->extraAttributes(['class'=>'no-padding'])
->id('reviewSection'),
])
];
}
public function form(Form $form): Form
{
return $form->schema(static::formSchema());
}

public static function formSchema(): array
{
return [
Split::make([
Section::make([
static::getContactInboxConversation(),
])
->footerActions([
Action::make('previous_action')
->action(logger('previous_action')),
Action::make('next_action')
->action(logger('next_action')),
])
->extraAttributes(['class'=>'no-padding'])
->id('reviewSection'),
])
];
}
is better The actions should work correctly thought, I was trying to pin point any issue. I see no reason the actions are being run at the same time... Plese create a reproduction repository?
ddoddsr
ddoddsrOP2w ago
In the middle of a reproduction repository and I wondered if there was a repo to clone for that purpose?
toeknee
toeknee2w ago
No, just need a site that we can spin up. Native laravel and filament install.
ddoddsr
ddoddsrOP2w ago
I wasn't sure if the issue would disappear... but here it is https://github.com/ddoddsr/test-action-misfire
GitHub
GitHub - ddoddsr/test-action-misfire
Contribute to ddoddsr/test-action-misfire development by creating an account on GitHub.
ddoddsr
ddoddsrOP2w ago
login [email protected] pw asdfasdf OK there it is , I duplicated the issue .
Solution
LeandroFerreira
You should pass an action or a closure to the action method
->action(fn () => logger('previous_action'))
->action(fn () => logger('previous_action'))
toeknee
toeknee2w ago
Ahh of course because it's evaluated on boot isn't it duh.
ddoddsr
ddoddsrOP2w ago
Always pass an Action ot Closure.. Yes that was something I missed. Because it is static?
toeknee
toeknee2w ago
It maybe static but the closure makes it programtic and each one is evaluated
Want results from more Discord servers?
Add your server