-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Change the #[function_component] attribute to #[component] by default #3447
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
base: master
Are you sure you want to change the base?
Conversation
Visit the preview URL for this PR (updated for commit 3238bb5): https://yew-rs--pr3447-components-315ai2yg.web.app (expires Thu, 12 Oct 2023 12:12:13 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.
I am in favour of this change for a shorter name for function component.
Thanks!
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.
Sorry it took me so long to finish this review. I like this change. There are files/lines that aren't changed but still show up as changed. Can you see what's up with those?
@@ -0,0 +1,12 @@ | |||
#![no_implicit_prelude] |
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.
Can you use a failing test for this so the deprecated output also shows up? You can place compile_fail!
to make the compilation fail
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 am unsure what you mean. Currently, the function_component is simply a re-export and is not marked as deprecated. If you wish this to be the case, I can change that, I wasn't sure what the preferred behaviour was.
} | ||
|
||
fn main() {} | ||
use std::marker::PhantomData; |
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.
What are the changes here? It shows every line as removed and then added
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 don't know why this happened. I also saw this after my commit. The same holds for the other file you also mentioned. I do not know what I should do here, because I can't really revert anything as nothing has changed...
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.
After some googling, I think I know why. I originally started working on my desktop and naively copied over some files to my laptop to finish this PR. My desktop uses windows and therefore maybe uses different line feed endings (the \r\n vs \n).
I am new to making contributions, do you know how I can rectify this? Should I make another commit where I take a copy from the original files and replace them?
} | ||
|
||
fn main() {} | ||
use yew::prelude::*; |
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.
Why is showing diff on unchanged files?
Description
Change the #[function_component] attribute to #[component] by default (the original name is kept as a re-export for backwards compatability).
With the current state of function components, it is no longer required to have a verbose name.
All occurences in the examples, docs and internal use have been changed to #[component].
Checklist