Closed pavelkameisha closed 2 years ago
Since we tried to reduce the url to only add submitted filter a lot of changes were made. https://github.com/sonata-project/SonataAdminBundle/pull/6895 https://github.com/sonata-project/SonataAdminBundle/pull/6871 https://github.com/sonata-project/SonataAdminBundle/pull/7254
Maybe we forgot one case, cc @kirya-dev
But if you think it's related to 3.90 version and https://github.com/sonata-project/SonataAdminBundle/pull/6877, I'll ping @willemverspyck too.
After some tries, this is what happened:
Prior to all the filters changes, this was the query parameters:
In this example, operationOrigin is a choice with multiple values. As you can see the value is not submitted since it's an empty array. But since the type was submitted, the key was here and so we still override the default values for operationOrigin when doing the array_merge.
Then @kirya-dev remove all the filters with default value from the url/request. This means that the type is not submitted anymore. Since both the value (because an empty value) and the type (because it's a default value) are not submitted, the array_merge doesn't override anymore the default value.
I tried to keep the type submitted when the value was an empty array. But with the introduction of ParametersManipulator::merge
it's not enough to fix the issue. So it would require to modify this merge logic too.
But I just thought that this would say that the bug was already here for filter without a type field (and my fix won't be able to fix it).
I see two solutions so far
.find('[name*=filter][name$="[]"]')
, and change the php logic for the merge: If the value is an array, we don't keep the old one since it's supposed to always be submitted.Any better idea ? @kirya-dev @sonata-project/contributors ?
Hi guys! I think problem in understadning represantation parameters in HTTP uri. When you are submitting form field (multiple) and no selected options browser dont present this params in uri. In my small opinion in this case send reserved value that none selected. (Convert empty array to empty string?)
Its solves by JS. But JS disabled problem will saved.
For checkbox best practie is add empty form element with same name.
PS.This problem was before deleting non default params..
Environment
Sonata packages
Symfony packages
PHP version
Subject
I have caught a bug in version 3.90+ I have a filter field with multiple choice and default values. Since 3.90 I can't just clear this field, because after reloading page I get filled field with default values.
Steps to reproduce
Expected results
After submitting the filter with empty orderType field I get all available orders.
Actual results
After submitting the filter with empty orderType field I get orders filtered by default values. And orderType field is filled.
Notes
Maybe this row causes the error: