Skip to content
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

Main App cannot be autoprops #9

Closed
kirillsemyonkin opened this issue Oct 31, 2023 · 6 comments · Fixed by #10
Closed

Main App cannot be autoprops #9

kirillsemyonkin opened this issue Oct 31, 2023 · 6 comments · Fixed by #10

Comments

@kirillsemyonkin
Copy link
Collaborator

For consistency reasons, I tried to write following:

#[autoprops_component]
fn App() -> Html {
    html! {}
}

This comes up with following error on a CSR render:

the function or associated item `new` exists for struct `Renderer<App>`, but its trait bounds were not satisfied
the following trait bounds were not satisfied:
`AppProps: std::default::Default`
- doesn't satisfy `AppProps: std::default::Default`
- consider annotating `AppProps` with `#[derive(Default)]`: `#[derive(Default)]`

This is probably due to fact that props struct generates for App even if there are no props (as mentioned in #7).

  • Get rid of generating a props struct for propless autoprops components
  • Otherwise possibly make empty struct a Default? (Also, consider manual impl Default where all types are Default - this is possible by listing where type1: Default, type2: Default, no matter how simple or complex the type is - you can even type out where i32: Default and it will still work)
@valyagolev
Copy link
Contributor

Thank you for all of the reports. To be honest, I don't use yew anymore (primarily switched to dioxus), and will unlikely tackle any of the issues myself. But you're welcome to send PRs, and I can give you commit rights too

@kirillsemyonkin
Copy link
Collaborator Author

I don't use yew anymore

Its all good if you still accept PRs and release new versions, otherwise consider transferring ownership

@valyagolev
Copy link
Contributor

Its all good if you still accept PRs and release new versions,

I won't mind for now

otherwise consider transferring ownership

If anyone is interested, why not

@kirillsemyonkin
Copy link
Collaborator Author

If anyone is interested, why not

That would be me, @cecton, or, if possible, yewstack

@cecton
Copy link
Member

cecton commented Nov 1, 2023

I don't think it will be necessary. I will make a PR now to port the feature to Yew. If it succeeds, you will be able to archive the repository

@cecton
Copy link
Member

cecton commented Nov 2, 2023

This one is already fixed in the autoprops port on Yew

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants