-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Livewire set and first rule for QueryString to Url attributes #222
Livewire set and first rule for QueryString to Url attributes #222
Conversation
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 |
@peterfox I haven't found much in documentation 😃 Then after looking into code i think we need to handle more than one case? 🤔 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. |
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 |
…g-to-url-attributes' into feature/livewire-query-string-to-url-attributes
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