filament icon indicating copy to clipboard operation
filament copied to clipboard

EditRecord's refreshFormData method does not work with DateTimePicker

Open 3rgo opened this issue 8 months ago • 4 comments

Package

filament/filament

Package Version

v3.2.90

Laravel Version

v10.48.12 (also applies to v11.10.0 as shown by the reproduction repository)

Livewire Version

No response

PHP Version

8.3.7

Problem description

On an EditRecord page for my resource, I added 2 header actions that update a datetime field in my Model (set as datetime cast with no mutator/accessor).

This field is displayed using the Forms\Components\DateTimePicker component, without any extra logic.

When I call the refreshFormData method in my action ($this->refreshFormData(['registration_end']);, the DateTimePicker's value is cleared even though a value is set in the database.

If I change the field type to TextInput, the update is shown immediately.

Expected behavior

The DateTimePicker field value should be updated according to new model value, without having to refresh the page

Steps to reproduce

  • Install reproduction repo, migrate, seed
  • Login
  • Go to Event resource
  • Edit the existing event
  • Click on "Clear registration end" action => Registration end field is cleared (OK)
  • Refresh page => Still clear (OK)
  • Click on "Random registration end" action => Registration end field is still clear (Not OK)
  • Refresh page => Field has a value (OK)
  • Click on "Random registration end" action => Registration end field is cleared (Not OK)
  • Refresh page => Field has a value (OK)

To confirm, change field type to TextInput and repeat action calls, refresh will be performed properly

Reproduction repository (issue will be closed if this is not valid)

https://github.com/3rgo/filament-refreshformdata-datetimepicker

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

3rgo avatar Jun 13 '24 10:06 3rgo