Closed peterfox closed 6 days ago
what will happen in this case?
public $foo;
public $search = '';
public $page = 1;
protected $queryString = [
'foo',
'search' => ['except' => ''],
'page' => ['except' => 1],
];
@MrPunyapal currently it will ignore it. Do you know what the translation of that would be with the attribute? I forgot that was an option available
That feature is no longer available.
So first do key to value.
- 'property' => ['except' => 'something'],
+ 'property'
Then just the same as what we did previously
Maybe this helps: https://livewire.laravel.com/docs/upgrading#url-query-string
Okay cool. That should be simple enough to resolve 👍
@MrPunyapal I've now adapted for the scenario mentioned where the array's key might be the property.
I guess we missed something? 🤔
The whole queryString property isn't deprecated 🤔
https://livewire.laravel.com/docs/upgrading#url-query-string
Doesn't really matter if it's not deprecated. The rule is still useful for those who want to convert from Livewire 2 to 3 as it covers most of the scenarios. I guess the only thing that should be done is to ignore any instances where 'keep' => true
is used.
@peterfox I haven't found much in documentation 😃
Then after looking into code i think we need to handle more than one case? 🤔 Attribute: https://github.com/livewire/livewire/blob/main/src%2FFeatures%2FSupportQueryString%2FBaseUrl.php#L12-L18
Legacy support: https://github.com/livewire/livewire/blob/main/src%2FFeatures%2FSupportQueryString%2FSupportQueryString.php#L20-L26
Okay cool, so it's probably best to create the attributes with the parameters if set.
@MrPunyapal currently it will ignore it. Do you know what the translation of that would be with the attribute? I forgot that was an option available
Yeah revert to this for now 🤔
@MrPunyapal new version of the rule. Now covers transforming cases of 'as' and 'except' to be converted with the attributes into arguments.
looks good
Changes
Why
Livewire 3.0 is an official package for Laravel and a popular one. Livewire 3.0 introduced some changes to components from past versions. It makes sense for those rules to still live within the Laravel package.
Example of Rule use
The rule will perform a simple conversion. It avoids applying if there's a mismatch between what's in the array and the properties existing.
becomes