LiveComponent LiveProp onUpdated option
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.
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
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
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
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!
Thank you for this issue. There has not been a lot of activity here for a while. Has this been resolved?
Friendly reminder that this issue exists. If I don't hear anything I'll close this.
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!