filament icon indicating copy to clipboard operation
filament copied to clipboard

Hook for when action modal is closed

Open danharrin opened this issue 2 years ago • 1 comments

Donate 💰 to fund this issue

  • You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
  • 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
  • Thank you in advance for helping us make maintenance sustainable!
Fund with Polar

danharrin avatar Dec 06 '23 12:12 danharrin

Hey, do you mind if I submit a PR for this? If I may, should I rename the after() hook to afterSubmit()? Then I can create afterClose/afterCancel() to avoid confusion. Or should I keep it just as afterClose()?

thethunderturner avatar Aug 20 '24 17:08 thethunderturner

Before implementing this I would like someone to reply here and let me know what use case they have for this hook, so that I can make sure needs are met. I have heard a lot of requests for this but would like to extra clarification before proceeding.

danharrin avatar Nov 30 '24 11:11 danharrin

Before implementing this I would like someone to reply here and let me know what use case they have for this hook, so that I can make sure needs are met. I have heard a lot of requests for this but would like to extra clarification before proceeding.

I personally have no use for it, I made the PR because there was an issue for it. During the summer I accidentally deleted it though 😅. I can make it again if thats ok. If there is no use for the PR, we can ignore it.

thethunderturner avatar Nov 30 '24 15:11 thethunderturner

Yeah I'm just struggling to imagine how you would use it, hence why I haven't merged it

danharrin avatar Nov 30 '24 18:11 danharrin

Example usage:

  1. The user needs to get onboarded to a page
  2. So you call an action modal on load
  3. The user reads the description in the modal and then closes the modal
  4. On close, set has_seen_xpage_onboarding to true on the user model

trevorgreenleaf avatar Jan 01 '25 20:01 trevorgreenleaf

Should you not do that when the modal is opened, mountUsing()? So then it still gets recorded if you close the browser instead of the modal?

danharrin avatar Jan 01 '25 20:01 danharrin

I have a use case for this... I have a module that automatically opens unread announcements for users... one by one, so after the user closes, it automatically opens the next one...

But i can think of many use cases for this, like setting the modal as read, maybe you want to track when the user opens it, but also when you closed... etc...

dbpolito avatar Jan 06 '25 21:01 dbpolito

Would that not be better with "Next" and "Previous" buttons in the modal footer instead of shoving each announcement in the user's face when they try and quit?

danharrin avatar Jan 24 '25 09:01 danharrin

Yeah sorry guys but as per our discussion I am still not convinced this is useful, and I think the implementation is pretty tricky to catch every case where a modal is "closed". Going to cancel the feature for now, might reconsider again in the future if I hear some good use cases.

danharrin avatar Feb 02 '25 20:02 danharrin