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

yew-router example does not compile #3547

Open
2 of 5 tasks
AndreasBergmeier6176 opened this issue Nov 30, 2023 · 5 comments · May be fixed by #3552
Open
2 of 5 tasks

yew-router example does not compile #3547

AndreasBergmeier6176 opened this issue Nov 30, 2023 · 5 comments · May be fixed by #3552

Comments

@AndreasBergmeier6176
Copy link

This is about:

  • A typo
  • Innaccurate/misleading documentation (e.g. technically incorrect advice)
  • Undocumented code
  • Outdated documentation
  • Other

Problem

When copying https://yew.rs/docs/next/concepts/router into an editor, I get:

the trait bound `yew_router::Switch<Route>: yew::Component` is not satisfied
the trait `yew::Component` is implemented for `ContextProvider<T>`
required for `yew_router::Switch<Route>` to implement `yew::BaseComponent`

I use latest version of all packages.

Maybe it would be good to either always compile the example code as part of a release or be more specific with which versions that example code used to work.

@ranile
Copy link
Member

ranile commented Nov 30, 2023

Your versions are incorrect. All the examples are tested as part of CI run on every commit. Please show your Cargo.toml file

@abergmeier
Copy link

abergmeier commented Dec 1, 2023

[package]
name = "foo"
version = "0.1.0"
edition = "2021"
description = "Template for starting a Yew project using Trunk"
readme = "README.md"
repository = "https://github.com/yewstack/yew-trunk-minimal-template"
license = "MIT OR Apache-2.0"
keywords = ["yew", "trunk"]
categories = ["gui", "wasm", "web-programming"]

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
serde_json = "1.0.108"
yew = { version="0.21", features=["csr"] }
yew-router = { git = "https://github.com/yewstack/yew.git" }

What does seem to work though is using:

yew-router = "0.18.0"

@ranile
Copy link
Member

ranile commented Dec 1, 2023

You can't have mismatched versions. Either use both versions from crates.io or git. Yew from git is a different crate compared to 0.21 from crates.io and vice versa. yew-router from git depends on yew from git, so you can't have yew from crates.io there.

This is nothing that yew can do anything about. This is how Rust dependencies work

@ranile ranile closed this as not planned Won't fix, can't repro, duplicate, stale Dec 1, 2023
@ranile ranile added invalid Issue is invalid/unactionable and removed documentation labels Dec 1, 2023
@abergmeier
Copy link

Note however, that https://yew.rs/docs/concepts/router indicates to simply add the git variant - which seems to be the wrong thing to do for most users IMO.

@ranile ranile added documentation and removed invalid Issue is invalid/unactionable labels Dec 1, 2023
@ranile ranile reopened this Dec 1, 2023
@ranile
Copy link
Member

ranile commented Dec 1, 2023

Would you like to PR a change for 0.21 docs?

@abergmeier abergmeier linked a pull request Dec 1, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants