Skip to content

[LiveComponent] LiveProp modifier for changing URL mapping no longer works after updating to 2.29.1 #2991

@momocode-de

Description

@momocode-de

I have a live component with the following LiveProps:

#[LiveProp]
public string $listIdentifier;

#[LiveProp(writable: true, onUpdated: 'onDataChanged', url: new UrlMapping(as: 's'), modifier: 'modifyQueryProp')]
public string $sort = '';

and this "modifyQueryProp" function:

public function modifyQueryProp(LiveProp $liveProp): LiveProp
{
    $urlMapping = $liveProp->url();
    if (!$urlMapping instanceof UrlMapping) {
        return $liveProp;
    }

    $alias = $this->listIdentifier . $urlMapping->as;

    return $liveProp->withUrl(new UrlMapping(as: $alias));
}

The component can appear several times on a page, but it always has an individual “listIdentifier.” To avoid collisions between the URL parameters, I always write the listIdentifier first in the "as" value, followed by the "as” value defined in LiveProp.

I have now updated from 2.24.0 to 2.29.1. Before, it had worked as desired. For example, if the listIdentifier was “foo” and I then changed the "sort" LiveProp to “bar,” the URL would contain the following: &foos=bar

Since the update, only the “as” value defined in LiveProp is now included in the URL: &s=bar

The change made in the modifier is therefore no longer effective.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions