Skip to content

@sortablelink parameter #3 not updating and using current value #144

Description

@seche

Noticed a simple bug, same as #88 but since the fix wasn't applied, I figured it needed to be raised again.

When the parameter is already set/active in your current URL, whatever you put in the 3rd parameter @sortablelink('address', trans('fields.address'), ['filter' => 'active, visible']) doesn't override the value.

So if your URL http://127.0.0.1:8000/home?foo=bar&sort=name&direction=asc where foo= bar. Using @sortablelink('address', trans('fields.address'), ['foo' => 'manchu']) will still give you a URL with foo = bar.

The fix is basically swapping the variables $persistParameters and $queryParameters on line 241 of SortableLink.php $queryString = http_build_query(array_merge($persistParameters, $queryParameters, [ so that what you pass @sortablelink overrides what is currently set.

I understand that you can explicitly override the Get variable @sortablelink('name', __('head.name'), ['var' => request()->get('var', 'bar')]) but one should assume that setting a variable in the function call should work. And it's a super simple fix.

Thanks

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions