[TwigComponent] Ignore "nested" for Alpine & Vue attributes#2328
Conversation
Have lost time on Twig & the website 😓
Co-authored-by: Hugo Alliaume <hugo@alliau.me>
Running scenario: Short attributes, empty rendered __toString() time: 0.00077986717224121 seconds __toString2() time: 0.00049495697021484 seconds Improvement: 36.533170284317% Running scenario: Short attributes, partial rendered __toString() time: 0.00054383277893066 seconds __toString2() time: 0.00031709671020508 seconds Improvement: 41.692240245506% Running scenario: Short attributes, full rendered __toString() time: 0.00030899047851562 seconds __toString2() time: 0.00012898445129395 seconds Improvement: 58.256172839506% Running scenario: Long attributes, empty rendered __toString() time: 0.0038020610809326 seconds __toString2() time: 0.0026099681854248 seconds Improvement: 31.353859660124% Running scenario: Long attributes, partial rendered __toString() time: 0.0032980442047119 seconds __toString2() time: 0.0022611618041992 seconds Improvement: 31.439311790646% Running scenario: Long attributes, full rendered __toString() time: 0.00074219703674316 seconds __toString2() time: 0.00014185905456543 seconds Improvement: 80.886604561516%
|
I am sorry but I don't like the solution taken here. I like way more the initial solution taken here: #2325. I think we should not add code specific to another framework, and I don't think that we should ignore nested attributes without making them implicit for the user. I think we should focus on a solution like the initial solution where the user choose to ignore it implicitly. |
|
What about #2325 (comment) then? I don't find that super friendly, it not obvious at all, and can be a source of frustration to the user even if it's documented (and document that you need to explicitly use a new syntax to disable nested attributes to makes your code works, feels like a loss to me) |
|
Are we really considering there is real scenario where someone
? Regarding specific code, we have some for LiveComponent & Alpine already. On the other hand, opening a new char / syntax in the attributes will be a change with many more problems. |
|
Thank you @smnandre for taking care of this regression. |
Have lost time on Twig & the website 😓
Alternative implementation of #2325
Update: Improved
__toStringperformance following @Kocal commentsNow all these attributes are directly rendered
x-<div x-data="{ open: false }" x-show="open"></div>v-<input v-model="message" v-if="show">@<my-component @onClick="handleClick"></my-component>@<button @click="${this.handleClick}">Click me</button>