Action button not working on first click

Hello, fellow devs!

I've added a Filament Action named Link Payment to my filament table. When I click on it, it opens a Livewire modal. Inside this modal, there's another action called Create Contact, but I'm facing an issue. The first time I click "Create Contact", it doesn't work, but the second time it does. The same issue occurs with another action on the page. I've also implemented search functionality, and after a search, the action works on the first click. The problem arises only when the page loads; I have to click twice. After that, if I close the modal and reopen it, it works normally. Also as you can see in the video (end part), if I click on the Create Contact button first and then click on the link icon action next, it opens the Create Contact functionality.

I've shared a video of the issue and the code link below:

Code: https://gist.github.com/dushmanta05/f325536e88d3e568bec2c16ff8eb4b4c

Flow of the code:
  • I have an OrphanPayments.php filament widget file. It contains a payment table with an action named Link Payment.
  • Clicking on Link Payment opens a modal written in Livewire (PaymentSearchRenderHelper.php file) with its corresponding view file as payment-search-render-helper.blade.php.
  • The Livewire file mentioned above sends the data to another Livewire file PreviewPaymentContactSearch.php along with preview-payment-contact-search.blade.php as its corresponding blade file.
  • The issue occurs in PreviewPaymentContactSearch.php where the Create Contact Action lies.
Note:
  • I've tried using dd() and it works on the first click.
  • I also tried using the updating() lifecycle hook of Livewire, but it works on the second click, not the first.
I would appreciate any help regarding this issue. Thank you for your valuable time.
If more information required, please feel free to reply in the comments. Thank you again.
Gist
Orphan Payment Link. GitHub Gist: instantly share code, notes, and snippets.
Was this page helpful?