filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.

Home Page:https://filamentphp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Two clicks are required to Save the form on Simple resource with live and placeholder fields

skills-up opened this issue · comments

Package

filament/filament

Package Version

v3.2.82

Laravel Version

v11.8.0

Livewire Version

v3.5.0

PHP Version

PHP 8.2.18

Problem description

When I'm using a simple resource with a few live fields and a Placeholder field, I need to click on Save button twice to save the changes and close the pop-up.

Expected behavior

Single click on Save button should suffice for saving the record and closing the modal.

Steps to reproduce

Create a resource with a few live fields and a Placeholder field whose value is changed on update on any of these live fields. Both live and placeholder fields must be present on the form as there is no issue if either of these are absent. Now change the value of a live field (which will trigger the update of placeholder field). Now edit a record of this resource. Click on Save button (nothing happens). Click on Save button again to save the record and close the modal.

Alternatively, in the linked repository, updated an Order Item.

Reproduction repository

https://github.com/skills-up/demo

Relevant log output

No response

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

The link to the reproduction repo is not working.

I've created a new repo for reproduction at https://github.com/skills-up/demo
The issue will arise in Order Items on update (not on create).

I added a debounce: 200 to the live method, instead of onBlur: true.

That indeed solved the issue. Though I'm worried about performance impact.

The state on the server will be updated after 200ms, after you finished typing on the input.

So you are fine with the performance.

Next time please add an actual reproduction repository with clear steps for that specific reproduction project, @skills-up.

I've personally run into this issue too, so I can confirm this is something that needs to be fixed.

Next time please add an actual reproduction repository with clear steps for that specific reproduction project, @skills-up.

I've personally run into this issue too, so I can confirm this is something that needs to be fixed.

I've updated the original bug report to include the link and step that I had added via a comment.

The main reason why this happens is because Filament disables the button while your calculation is in progress. And not provide any visual feedback about loading.

Screencast.2024-06-11.12.03.38.mp4

One possible solution is to preload the price of the item in a hidden field, for example, to speed up calculations.