-
Notifications
You must be signed in to change notification settings - Fork 393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow shorthand for directives like lwc:ref
#3303
Comments
Thanks for the feedback!
Yep, as mentioned in #2503 (comment), this is to make it clear what is native to the web platform and what is part of LWC. This tells developers whether they should be searching for documentation on MDN or on Salesforce/lwc.dev. 🙂
No. Closing this issue, as we don't currently plan to shorten |
Reopening this. After some internal discussion, it seems that it may be reasonable to support This might also be a good time to harmonize some of the directives that don't start with
The above two could be done in a backwards-compatible way; they would just be synonyms. |
lwc:ref
This issue has been linked to a new work item: W-12415033 |
In my opinion, reading I would love if you could actually change the for:each directive entirely. Something like:
I also believe that joining the two directives in one will simplify the template engine because you won't need to parse separately 2 directives and then merge their information before validating if it is correct or not. It is similar to vue. The only difference is the addition of the word would be much better because it would reduce the amount of characters in a template, while also respecting the English grammar and keeping the word But if you can't really change it. What about using |
I'm up for shorting |
As always thanks for raising this @AllanOricil. I am also up for finishing the migration of all the LWC directives to Over the last 5 years, we have learned how LWC developers are using the existing directives. And as part of the harmonization process, I would like to make sure we also fix some of the design flaws in the
|
@pmdartus this.todoItems = this.todoItems.filter((t)=>t.include)) Does lwc throw away all 1000 elements from the DOM and then mount new ones, or does it patch some elements and unmount the ones that were deleted from the array? Not sure how Vue does it, but their doc says it has a "smart heurist algorithm" that it is used to avoid unnecessary changes to the DOM when an array used in a for loop is mutated. So, if lwc does not currently have something like this, maybe this could be another good optimization you could implement. |
Yes, it's something that is baked into LWC rendering engine from day 1. You can find this logic in here in LWC, and here in Vue. |
Is your feature request related to a problem? Please describe.
no, I just would like to know if it could be simplified. And nice feature, by the way. We can get rid of
data-id
parameters in our templates.https://developer.salesforce.com/blogs/2023/01/lwc-enhancements-for-developers-learn-moar-spring-23
Is there a reason for prepending "ref" with the word "lwc:" ?
Couldn't it just be
Vue and React template engines are able to use just "ref", so I believe lwc would also be able to do it. It would be good if you could try to follow what other frameworks did well, so that people that are used to one of them can learn lwc faster. I only see benefits doing so.
Another question, does it accept expressions?
Like,
The text was updated successfully, but these errors were encountered: