purton-tech / rust-on-nails

Full stack web architecture for Rust
https://rust-on-nails.com
MIT License
320 stars 27 forks source link

`ui-components` dioxus' latest version(0.5) makes build fail #65

Open ekusiadadus opened 1 month ago

ekusiadadus commented 1 month ago

The build fails unless the dioxus version is pinned to the 0.4 series.

image

$ cargo run
warning: virtual workspace defaulting to `resolver = "1"` despite one or more workspace members being on edition 2021 which implies `resolver = "2"`
note: to keep the current resolver, specify `workspace.resolver = "1"` in the workspace root's manifest
note: to use the edition 2021 resolver, specify `workspace.resolver = "2"` in the workspace root's manifest
note: for more details see https://doc.rust-lang.org/cargo/reference/resolver.html#resolver-versions
   Compiling db v0.1.0 (/workspace/crates/db)
   Compiling ui-components v0.1.0 (/workspace/crates/ui-components)
error: Expected a valid body node.
       Expressions must be wrapped in curly braces.
  --> crates/ui-components/src/layout.rs:31:13
   |
31 |             &cx.props.children
   |             ^

error: missing trailing comma
  --> crates/ui-components/src/users.rs:24:25
   |
24 |                         cx.props.users.iter().map(|user| rsx!(
   |                         ^^

error[E0412]: cannot find type `Scope` in this scope
  --> crates/ui-components/src/layout.rs:12:23
   |
12 | pub fn Layout<'a>(cx: Scope<'a, AppLayoutProps<'a>>) -> Element {
   |                       ^^^^^ not found in this scope
   |
help: consider importing this struct
   |
3  + use std::thread::Scope;
   |

error[E0412]: cannot find type `Scope` in this scope
  --> crates/ui-components/src/users.rs:12:16
   |
12 |     fn app(cx: Scope<Props>) -> Element {
   |                ^^^^^ not found in this scope
   |
help: consider importing this struct
   |
1  + use std::thread::Scope;
   |

warning: unused import: `crate::layout::Layout`
 --> crates/ui-components/src/users.rs:1:5
  |
1 | use crate::layout::Layout;
  |     ^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(unused_imports)]` on by default

error[E0107]: type alias takes 0 lifetime arguments but 1 lifetime argument was supplied
  --> crates/ui-components/src/layout.rs:9:15
   |
9  |     children: Element<'a>,
   |               ^^^^^^^---- help: remove these generics
   |               |
   |               expected 0 lifetime arguments
   |
note: type alias defined here, with 0 lifetime parameters
  --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/dioxus-core-0.5.1/src/lib.rs:46:14
   |
46 |     pub type Element = Option<VNode>;
   |              ^^^^^^^

error[E0478]: lifetime bound not satisfied
 --> crates/ui-components/src/layout.rs:6:10
  |
6 | #[derive(Props)]
  |          ^^^^^
  |
note: lifetime parameter instantiated with the lifetime `'a` as defined here
 --> crates/ui-components/src/layout.rs:7:27
  |
7 | pub struct AppLayoutProps<'a> {
  |                           ^^
  = note: but lifetime parameter must outlive the static lifetime
  = note: this error originates in the derive macro `Props` (in Nightly builds, run with -Z macro-backtrace for more info)

Some errors have detailed explanations: E0107, E0412, E0478.
For more information about an error, try `rustc --explain E0107`.
warning: `ui-components` (lib) generated 1 warning
error: could not compile `ui-components` (lib) due to 10 previous errors; 1 warning emitted
warning: build failed, waiting for other jobs to finish...
JoshuaMichaelHanson commented 3 weeks ago

I also needed to downgrade for the example to work. I almost got it converted over but was still having some issues on the users.tier().map() part. The Dioxus site got me most of the way there but decided to keep moving forward and come back to this issue later. I am guessing one of us could do a PR once we figure out what needs to be updated. https://dioxuslabs.com/learn/0.5/migration/props