Skip to content

Commit a4f7a41

Browse files
committed
upgrade to yew 0.22, fix #51
1 parent 7941e2a commit a4f7a41

19 files changed

Lines changed: 24 additions & 24 deletions

crates/yew-hooks-test/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ documentation = "https://github.com/jetli/yew-hooks"
1515
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1616

1717
[dependencies]
18-
yew = { version = "0.21.0", features=["csr"]}
18+
yew = { version = "0.22.0", features=["csr"]}

crates/yew-hooks/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "yew-hooks"
3-
version = "0.3.4"
3+
version = "0.4.0"
44
edition = "2021"
55
authors = ["Jet Li <jing.i.qin@icloud.com>"]
66
categories = ["gui", "wasm", "web-programming"]
@@ -16,7 +16,7 @@ documentation = "https://docs.rs/yew-hooks/"
1616

1717
[dependencies]
1818
log = "0.4"
19-
yew = { version = "0.21.0", features = ["csr"] }
19+
yew = { version = "0.22.0", features = ["csr"] }
2020
gloo = "0.11"
2121
wasm-bindgen = "0.2"
2222
wasm-bindgen-futures = "0.4"

crates/yew-hooks/src/hooks/use_list.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ impl<T> UseListHandle<T> {
1818
/// # Panics
1919
///
2020
/// Panics if the value is currently mutably borrowed
21-
pub fn current(&self) -> Ref<Vec<T>> {
21+
pub fn current(&'_ self) -> Ref<'_, Vec<T>> {
2222
self.inner.borrow()
2323
}
2424

crates/yew-hooks/src/hooks/use_map.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<K, V> UseMapHandle<K, V> {
1919
/// # Panics
2020
///
2121
/// Panics if the value is currently mutably borrowed
22-
pub fn current(&self) -> Ref<HashMap<K, V>> {
22+
pub fn current(&'_ self) -> Ref<'_, HashMap<K, V>> {
2323
self.inner.borrow()
2424
}
2525

crates/yew-hooks/src/hooks/use_queue.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<T> UseQueueHandle<T> {
1919
/// # Panics
2020
///
2121
/// Panics if the value is currently mutably borrowed
22-
pub fn current(&self) -> Ref<VecDeque<T>> {
22+
pub fn current(&'_ self) -> Ref<'_, VecDeque<T>> {
2323
self.inner.borrow()
2424
}
2525

crates/yew-hooks/src/hooks/use_set.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl<T> UseSetHandle<T> {
1919
/// # Panics
2020
///
2121
/// Panics if the value is currently mutably borrowed
22-
pub fn current(&self) -> Ref<HashSet<T>> {
22+
pub fn current(&'_ self) -> Ref<'_, HashSet<T>> {
2323
self.inner.borrow()
2424
}
2525

examples/yew-app/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ gloo = "0.11"
1717
js-sys = "0.3"
1818
serde = "1"
1919
reqwest = { version = "0.12.4", features = ["json"] }
20-
yew = { version = "0.21.0", features = ["csr"] }
21-
yew-router = { version = "0.18.0" }
20+
yew = { version = "0.22.0", features = ["csr"] }
21+
yew-router = { version = "0.19.0" }
2222
yew-hooks = { path = "../../crates/yew-hooks" }
2323
wasm-bindgen = "0.2"
2424
wasm-logger = "0.2.0"

examples/yew-app/src/app/hooks/use_before_unload.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ pub fn UseBeforeUnload() -> Html {
2121
<div class="container">
2222
<header class="mt-24 text-xl text-center">
2323
<div class="space-x-4 space-y-4">
24-
<Button {onclick}>{if *dirty { "Disable" } else { "Enable" }}</Button>
24+
<Button {onclick}>{ if *dirty { html! { "Disable" } } else { html! { "Enable" } } }</Button>
2525
<p>
26-
<b>{if *dirty { "Try to reload or close tab." } else { "" }}</b>
26+
<b>{ if *dirty { html! { "Try to reload or close tab." } } else { html! {} } }</b>
2727
</p>
2828
</div>
2929
</header>

examples/yew-app/src/app/hooks/use_drop.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,9 @@ pub fn UseDrop() -> Html {
3131
(*state.files).as_ref().map_or_else(
3232
|| html! {},
3333
|files| {
34-
html! {for files.iter().map(|file| {
35-
html! { <p> { file.name() }</p> }
36-
})}
34+
html! { for file in files.iter() {
35+
<p>{ file.name() }</p>
36+
} }
3737
},
3838
)
3939
}

examples/yew-app/src/app/hooks/use_effect_once.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ pub fn UseEffectOnce() -> Html {
3131
<div class="container">
3232
<header class="mt-24 text-xl text-center">
3333
<div class="space-x-4 space-y-4">
34-
<Button {onclick}>{ *toggle }</Button>
34+
<Button {onclick}>{ html! { *toggle } }</Button>
3535
<p>
3636
{
3737
if *toggle == "Unmount" {

0 commit comments

Comments
 (0)