ux icon indicating copy to clipboard operation
ux copied to clipboard

LiveComponent LiveProp onUpdated option

Open jeremy-ritec opened this issue 1 year ago • 1 comments

Consider this :

    #[LiveProp(writable: true, url: new UrlMapping(as: 's'), onUpdated: "onSubcategoryUpdated")]
    public array $courseSubcategory = [];

    #[LiveProp(writable: true, url: new UrlMapping(as: 'c'), onUpdated: "onCategoryUpdated")]
    public ?string $courseCategory = null;

    #[LiveProp(writable: true, onUpdated: "refresh")]
    public string $sort = 'relevance';

and the user already changed the $sort value ($sort is not "relevance" anymore) and so is the $courseSubcategory (not empty anymore). If I change the $courseCategory value, and the onCategoryUpdated() is triggered, the value of $sort becomes the initial one ie "relevance"; whereas $courseSubcategory keeps its current value.

And the bug persists not matter how the variable declarations order is. Variables declared above the triggered onUpdated function remember their current value, whereas those declared below use the initial ones.

jeremy-ritec avatar Sep 25 '24 08:09 jeremy-ritec

Do you think maybe you could show a tiny bit more of code ? 😄

Like, what's in "onSubcategoryUpdated" and "onCategoryUpdated" methods ?

And eventually what you mean by "if i change [...]" ? (in PHP ? JS ? via a form ? the URL ?)

Thank you

smnandre avatar Oct 05 '24 22:10 smnandre

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Apr 06 '25 12:04 carsonbot

Could I get an answer? If I do not hear anything I will assume this issue is resolved or abandoned. Please get back to me <3

carsonbot avatar Apr 20 '25 12:04 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar May 04 '25 12:05 carsonbot

Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?

carsonbot avatar Nov 05 '25 12:11 carsonbot

Friendly reminder that this issue exists. If I don't hear anything I'll close this.

carsonbot avatar Nov 19 '25 12:11 carsonbot

Hey,

I didn't hear anything so I'm going to close it. Feel free to comment if this is still relevant, I can always reopen!

carsonbot avatar Dec 03 '25 12:12 carsonbot