Skip to content

Commit 85ea6ea

Browse files
committed
upgrade yew 0.22
1 parent 2f075eb commit 85ea6ea

8 files changed

Lines changed: 34 additions & 41 deletions

File tree

.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
API_ROOT=https://api.realworld.io/api
1+
API_ROOT=https://api.realworld.show/api

.env.example.gh-pages

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
API_ROOT=https://api.realworld.io/api
1+
API_ROOT=https://api.realworld.show/api

crates/conduit-wasm/Cargo.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ gloo = "0.11"
1717
lazy_static = "1.4"
1818
log = "0.4"
1919
parking_lot = "0.12"
20-
pulldown-cmark = "0.10"
20+
pulldown-cmark = "0.13"
2121
reqwest = { version = "0.12", features = ["json"] }
2222
serde = "1"
23-
thiserror = "1"
24-
yew = { version = "0.21.0", features = ["csr"] }
25-
yew-router = "0.18.0"
26-
yew-hooks = "0.3"
23+
thiserror = "2"
24+
yew = { version = "0.22.0", features = ["csr"] }
25+
yew-router = "0.19.0"
26+
yew-hooks = "0.4"
2727
wasm-bindgen = "0.2"
2828
wasm-logger = "0.2"
2929

crates/conduit-wasm/src/app/article/comment_input.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@ pub fn CommentInput(props: &Props) -> Html {
6666
placeholder="Write a comment..."
6767
rows="3"
6868
value={create_info.body.clone()}
69-
oninput={oninput} >
70-
</textarea>
69+
oninput={oninput} />
7170
</div>
7271
<div class="card-footer">
7372
{if user_ctx.is_authenticated() {

crates/conduit-wasm/src/app/editor.rs

Lines changed: 23 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,7 @@ pub fn Editor(props: &Props) -> Html {
189189
rows="8"
190190
placeholder="Write your article (in markdown)"
191191
value={update_info.body.clone()}
192-
oninput={oninput_body} >
193-
</textarea>
192+
oninput={oninput_body} />
194193
</fieldset>
195194
<fieldset class="form-group">
196195
<input
@@ -202,34 +201,30 @@ pub fn Editor(props: &Props) -> Html {
202201
{onkeypress}
203202
{onkeyup} />
204203
<div class="tag-list">
205-
{
206-
if let Some(tag_list) = &update_info.tag_list.clone() {
207-
html! {for tag_list.iter().map(|tag| {
208-
let onclick_remove = {
209-
let tag = tag.clone();
210-
let update_info = update_info.clone();
211-
Callback::from(move |_| {
212-
// Remove a tag
213-
let mut info = (*update_info).clone();
214-
if let Some(tag_list) = &mut info.tag_list {
215-
tag_list.retain(|t| t != &tag);
216-
}
217-
update_info.set(info);
218-
})
219-
};
220-
html! {
221-
<span class="tag-default tag-pill">
222-
<i class="ion-close-round"
223-
onclick={onclick_remove}>
224-
</i>
225-
{ &tag }
226-
</span>
204+
{for update_info.tag_list.as_ref().map(|tags| {
205+
tags.iter().map(|tag| {
206+
let onclick_remove = {
207+
let tag = tag.clone();
208+
let update_info = update_info.clone();
209+
Callback::from(move |_| {
210+
// Remove a tag
211+
let mut info = (*update_info).clone();
212+
if let Some(tag_list) = &mut info.tag_list {
213+
tag_list.retain(|t| t != &tag);
227214
}
228-
})}
229-
} else {
230-
html! {}
215+
update_info.set(info);
216+
})
217+
};
218+
html! {
219+
<span class="tag-default tag-pill">
220+
<i class="ion-close-round"
221+
onclick={onclick_remove}>
222+
</i>
223+
{ &tag }
224+
</span>
231225
}
232-
}
226+
})
227+
}).into_iter().flatten()}
233228
</div>
234229
</fieldset>
235230
<button

crates/conduit-wasm/src/app/home/tags.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub fn Tags(props: &Props) -> Html {
3535
href=""
3636
class="tag-default tag-pill"
3737
{onclick}>
38-
{ &tag }
38+
{ &*tag }
3939
</a>
4040
}
4141
})}

crates/conduit-wasm/src/app/settings.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ pub fn Settings() -> Html {
150150
rows="8"
151151
placeholder="Short bio about you"
152152
value={update_info.bio.clone()}
153-
oninput={oninput_bio} >
154-
</textarea>
153+
oninput={oninput_bio} />
155154
</fieldset>
156155
<fieldset class="form-group">
157156
<input

crates/conduit-wasm/src/components/article_preview.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ pub fn ArticlePreview(props: &Props) -> Html {
9797
{for article.tag_list.iter().map(|tag| {
9898
html! {
9999
<li class="tag-default tag-pill tag-outline" key={ (&tag).to_string() }>
100-
{ &tag }
100+
{ &*tag }
101101
</li>
102102
}
103103
})}

0 commit comments

Comments
 (0)