You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Remove shouldUpdate flag and do not update the state if we've found empty or duplicated keys. But maybe we should make a warning to make users understand that with duplicated keys state won't be updated
Expected behavior
I expect that changing the Select value will update the KeyValue state, but it works only If I change Select 2 times.
It works only if you are updating the resource with some filled value in KeyValue.
Steps to reproduce
Create resource
Paste example code in resource editing form
Create resource entity and put some json to entity in database
Update created entity and try to change select value
Package
filament/filament
Package Version
3.2
Laravel Version
10.10
Livewire Version
3.4
PHP Version
8.1
Problem description
I have a simple resource editing form.
Key value update state only from the second time
The problem in this script
Initializing the component with NON empty value triggers
updateState
method which switchesshouldUpdateRows
flag to falsehttps://github.com/filamentphp/filament/blob/3.x/packages/forms/resources/js/components/key-value.js#L15
https://github.com/filamentphp/filament/blob/3.x/packages/forms/resources/js/components/key-value.js#L105
While first updating field state we trigger next code which switch flag to true
https://github.com/filamentphp/filament/blob/3.x/packages/forms/resources/js/components/key-value.js#L72
I've found that this was required to fix this bug but we need to find a better decision. Maybe something like this:
Remove
shouldUpdate
flag and do not update the state if we've found empty or duplicated keys. But maybe we should make a warning to make users understand that with duplicated keys state won't be updatedExpected behavior
I expect that changing the Select value will update the KeyValue state, but it works only If I change Select 2 times.
It works only if you are updating the resource with some filled value in KeyValue.
Steps to reproduce
Reproduction repository
https://github.com/finoghentov/filament-key-value-bug
Relevant log output
No response
The text was updated successfully, but these errors were encountered: