-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Evaluate props in the order they're defined #2887
Conversation
Visit the preview URL for this PR (updated for commit b6fdd17): https://yew-rs--pr2887-prop-order-bwojsxjn.web.app (expires Sun, 02 Oct 2022 16:01:48 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 |
Benchmark - SSRYew Master
Pull Request
|
Size Comparison
✅ None of the examples has changed their size significantly. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, kind of a big and important change. One question before I approve: this doesn't change the order in which the special attributes and different kinds are executed.
I.e. in components, props are constructed before children
, always.
In elements, the order is normal attributes, boolean attributes, class
, listeners, children
.
Is it confusing that there is still some kind of ordering going on, and these different kinds of attributes are not interleaved?
That's a good point. I tested with props macro but I should also add a test with html macro. The evaluation is happening of all props, except children. Order doesn't matter for ref. Not sure if we shouldn't document it at all or describe that children are always last. I think that execution "in order they're defined" works for children too since children are always specified at the end of props list |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fine for now to have this components and figure out how to do it for elements later. children
being evaluated last is probably also expected, I don't recall explicitly specifying them as a prop instead of as html being supported behaviour.
Description
Evaluate props in the order they're defined and document this behavior
Fixes #1634
Checklist