diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-30 17:13:41 +0100 |
---|---|---|
committer | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-10-30 17:13:49 +0100 |
commit | 85e388455a09e307fea14e4c98ece65c463b7773 (patch) | |
tree | b145443510ab8b2a5688c80744fccfa73f1e2b4a | |
parent | Frontend: Setup skeleton route support (diff) | |
download | OSSE-85e388455a09e307fea14e4c98ece65c463b7773.tar.gz OSSE-85e388455a09e307fea14e4c98ece65c463b7773.tar.bz2 OSSE-85e388455a09e307fea14e4c98ece65c463b7773.zip |
Frontend: Update yew to follow master
This enables us to use the new Router API
-rw-r--r-- | Cargo.lock | 162 | ||||
-rw-r--r-- | frontend/Cargo.toml | 5 | ||||
-rw-r--r-- | frontend/src/app.rs | 2 | ||||
-rw-r--r-- | frontend/src/main.rs | 6 |
4 files changed, 130 insertions, 45 deletions
diff --git a/Cargo.lock b/Cargo.lock index 86291f5..7264d47 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -616,7 +616,7 @@ dependencies = [ name = "frontend" version = "0.1.0" dependencies = [ - "gloo 0.8.0", + "gloo", "gloo-net", "itertools", "lib", @@ -654,12 +654,27 @@ dependencies = [ ] [[package]] +name = "futures" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38390104763dc37a5145a53c29c63c1290b5d316d6086ec32c293f6736051bb0" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] name = "futures-channel" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "52ba265a92256105f45b719605a571ffe2d1f0fea3807304b522c1d778f79eed" dependencies = [ "futures-core", + "futures-sink", ] [[package]] @@ -675,6 +690,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "00f5fb52a06bdcadeb54e8d3671f8888a39697dcb0b81b23b55174030427f4eb" [[package]] +name = "futures-macro" +version = "0.3.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdfb8ce053d86b91919aad980c220b1fb8401a9394410e1c289ed7e66b61835d" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "futures-sink" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -692,8 +718,11 @@ version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "197676987abd2f9cadff84926f410af1c183608d36641465df73ae8211dc65d6" dependencies = [ + "futures-channel", "futures-core", "futures-io", + "futures-macro", + "futures-sink", "futures-task", "memchr", "pin-project-lite 0.2.9", @@ -753,22 +782,6 @@ dependencies = [ [[package]] name = "gloo" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23947965eee55e3e97a5cd142dd4c10631cc349b48cecca0ed230fd296f568cd" -dependencies = [ - "gloo-console", - "gloo-dialogs", - "gloo-events", - "gloo-file", - "gloo-render", - "gloo-storage", - "gloo-timers", - "gloo-utils", -] - -[[package]] -name = "gloo" version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3a4bef6b277b3ab073253d4bca60761240cf8d6998f4bd142211957b69a61b20" @@ -1117,6 +1130,15 @@ dependencies = [ ] [[package]] +name = "implicit-clone" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a937e630d3907d421944abd8edb5288936f1fde83aaaf1a8c6c89bb4222f0677" +dependencies = [ + "indexmap", +] + +[[package]] name = "indexer" version = "0.1.0" dependencies = [ @@ -1696,6 +1718,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] +name = "pinned" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a829027bd95e54cfe13e3e258a1ae7b645960553fb82b75ff852c29688ee595b" +dependencies = [ + "futures", + "rustversion", + "thiserror", +] + +[[package]] name = "pkg-config" version = "0.3.25" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1714,6 +1747,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" [[package]] +name = "prettyplease" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c142c0e46b57171fe0c528bee8c5b7569e80f0c17e377cd0e30ea57dbc11bb51" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] name = "proc-macro-error" version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1753,6 +1796,23 @@ dependencies = [ ] [[package]] +name = "prokio" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03b55e106e5791fa5a13abd13c85d6127312e8e09098059ca2bc9b03ca4cf488" +dependencies = [ + "futures", + "gloo", + "num_cpus", + "once_cell", + "pin-project", + "pinned", + "tokio 1.21.2", + "tokio-stream", + "wasm-bindgen-futures", +] + +[[package]] name = "quote" version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1929,6 +1989,12 @@ dependencies = [ ] [[package]] +name = "rustversion" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8" + +[[package]] name = "ryu" version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -1945,12 +2011,6 @@ dependencies = [ ] [[package]] -name = "scoped-tls-hkt" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e9d7eaddb227e8fbaaa71136ae0e1e913ca159b86c7da82f3e8f0044ad3a63" - -[[package]] name = "scopeguard" version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2329,6 +2389,17 @@ dependencies = [ ] [[package]] +name = "tokio-stream" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d660770404473ccd7bc9f8b28494a811bc18542b915c0855c51e8f419d5223ce" +dependencies = [ + "futures-core", + "pin-project-lite 0.2.9", + "tokio 1.21.2", +] + +[[package]] name = "tokio-tls" version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2381,10 +2452,22 @@ dependencies = [ "cfg-if 1.0.0", "log", "pin-project-lite 0.2.9", + "tracing-attributes", "tracing-core", ] [[package]] +name = "tracing-attributes" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] name = "tracing-core" version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -2747,16 +2830,21 @@ dependencies = [ [[package]] name = "yew" version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a1ccb53e57d3f7d847338cf5758befa811cabe207df07f543c06f502f9998cd" +source = "git+https://github.com/yewstack/yew/#da09755c27bfeb113e0c4b1096214a826f1e8388" dependencies = [ "console_error_panic_hook", - "gloo 0.4.2", - "gloo-utils", + "futures", + "gloo", + "implicit-clone", "indexmap", "js-sys", - "scoped-tls-hkt", + "prokio", + "rustversion", + "serde", "slab", + "thiserror", + "tokio 1.21.2", + "tracing", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", @@ -2766,11 +2854,11 @@ dependencies = [ [[package]] name = "yew-macro" version = "0.19.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fab79082b556d768d6e21811869c761893f0450e1d550a67892b9bce303b7bb" +source = "git+https://github.com/yewstack/yew/#da09755c27bfeb113e0c4b1096214a826f1e8388" dependencies = [ "boolinator", - "lazy_static", + "once_cell", + "prettyplease", "proc-macro-error", "proc-macro2", "quote", @@ -2780,17 +2868,14 @@ dependencies = [ [[package]] name = "yew-router" version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "155804f6f3aa309f596d5c3fa14486a94e7756f1edd7634569949e401d5099f2" +source = "git+https://github.com/yewstack/yew/#da09755c27bfeb113e0c4b1096214a826f1e8388" dependencies = [ - "gloo 0.4.2", - "gloo-utils", + "gloo", "js-sys", "route-recognizer", "serde", - "serde-wasm-bindgen", "serde_urlencoded", - "thiserror", + "tracing", "wasm-bindgen", "web-sys", "yew", @@ -2800,8 +2885,7 @@ dependencies = [ [[package]] name = "yew-router-macro" version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39049d193b52eaad4ffc80916bf08806d142c90b5edcebd527644de438a7e19a" +source = "git+https://github.com/yewstack/yew/#da09755c27bfeb113e0c4b1096214a826f1e8388" dependencies = [ "proc-macro2", "quote", diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml index 7cc9e0b..3730022 100644 --- a/frontend/Cargo.toml +++ b/frontend/Cargo.toml @@ -6,8 +6,9 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -yew = "0.19" -yew-router = "0.16" +# this is the development version of Yew +yew = { git = "https://github.com/yewstack/yew/", features = ["csr"] } +yew-router = { git = "https://github.com/yewstack/yew.git" } gloo = "0.8.0" web-sys = "0.3.60" wasm-bindgen = "0.2.83" diff --git a/frontend/src/app.rs b/frontend/src/app.rs index a1f63de..d98b955 100644 --- a/frontend/src/app.rs +++ b/frontend/src/app.rs @@ -82,7 +82,7 @@ impl Component for OSSE { } fn view(&self, ctx: &Context<Self>) -> Html { - let onsubmit = ctx.link().callback(|event: FocusEvent| { + let onsubmit = ctx.link().callback(|event: SubmitEvent| { event.prevent_default(); OSSEMessage::SearchSubmitted diff --git a/frontend/src/main.rs b/frontend/src/main.rs index 95b52e5..fd5ef3c 100644 --- a/frontend/src/main.rs +++ b/frontend/src/main.rs @@ -13,7 +13,7 @@ enum Route { OSSESearch { query: String }, } -fn switch_routes(routes: &Route) -> Html { +fn switch_routes(routes: Route) -> Html { match routes { Route::OSSEHome => html! { <OSSE api_endpoint={"http://127.0.0.1:4444"}/> @@ -29,12 +29,12 @@ fn yew_app() -> Html { html! { <> <BrowserRouter> - <Switch<Route> render={Switch::render(switch_routes)} /> + <Switch<Route> render={switch_routes} /> </BrowserRouter> </> } } fn main() { - yew::start_app::<App>(); + yew::Renderer::<App>::new().render(); } |