Action Modal no afterStateUpdated

I'm trying to call this modal, but nothing is executed when an option is selected
9 Replies
Patrick Boivin
Patrick Boivinβ€’17mo ago
You can't return an action from afterStateUpdated()... what are you trying to do specifically?
IndomieRendang
IndomieRendangβ€’17mo ago
He looks like to confirm the user selection, like "it's gonna be dangerous, are you sure to choose that?" Maybe with ->action(fn () => null) But this will only show a modal with no action (if it can) 😁
Patrick Boivin
Patrick Boivinβ€’17mo ago
Sure but afterStateUpdated() is not the place for that. Or did I miss anything?
IndomieRendang
IndomieRendangβ€’17mo ago
I'm also not sure about afterStateUpdated... Not in front of my laptop to try it, just thinking it might be possible, in addition with a cancel modal action to set the state back to null again..
awcodes
awcodesβ€’17mo ago
This should be handled either with a suffixAction() or a separate Actions form field. If you want to do anything in afterStatedHydrated() you would dispatch and listen to an event. Actions require a trigger and user interaction.
IndomieRendang
IndomieRendangβ€’17mo ago
I forgot about the trigger... So, having notification with centered position will be a good filament feature I think.
Notification::make()
->title('Are you sure')
->actions([
Action::make('confirm')->action(fn ($...) => ... )
])
->position(NotificationPosition::Center) // I think this feature will be very useful
->persistent()
->send()
Notification::make()
->title('Are you sure')
->actions([
Action::make('confirm')->action(fn ($...) => ... )
])
->position(NotificationPosition::Center) // I think this feature will be very useful
->persistent()
->send()
πŸ˜† So filament probably doesn't have built-in feature for this, but there must be a workaround to do...
wellingtonlajedo
wellingtonlajedoOPβ€’17mo ago
Guys, what I need is that when choosing a certain option in the select, a modal notification opens on the screen stating that it is not possible to continue with the registration. It doesn't need any action just that the notification is modal to lock the screen and only an ok button is available in the modal. In Notification I didn't find any method to make it modal, so I thought of an Action
awcodes
awcodesβ€’17mo ago
Not verified, but what if you do ->call() at the end of the action.
Want results from more Discord servers?
Add your server