Skip to content

Commit b40bf34

Browse files
docs: prepare 0.23 release (#4064)
* docs: add changelog entries for yew 0.23.0, yew-router 0.20.0, yew-agent 0.5.0 * docs: add migration guides for all three packages, translation is done by AI * docs: drop versioned docs and i18n for 0.18.0 and 0.19.0 * docs: use versioned crates.io deps and shorten cargo-generate command * docs: replace outdated JetBrains html! macro info with contribution note
1 parent b396831 commit b40bf34

File tree

423 files changed

+25459
-14835
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

423 files changed

+25459
-14835
lines changed

CHANGELOG.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,38 @@
11
# Changelog
22

3+
## ✨ yew **0.23.0** *(2026-03-10)*
4+
5+
bumping from 0.22 should require no code changes for most users.
6+
7+
### 🛠 Fixes
8+
9+
- No more broken child re-renders while setting parent's states. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4060](https://github.com/yewstack/yew/pull/4060)]
10+
- Ergonomics: Bare `None`s are now allowed for `Option<T>` props in the `html!` macro. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4021](https://github.com/yewstack/yew/pull/4021)]
11+
12+
### ⚡️ Features
13+
14+
- `&str` and `String` can now be used for prop types of `Option<Html>`. [[@Cashew](https://github.com/Casheeew), [#4020](https://github.com/yewstack/yew/pull/4020)]
15+
16+
### 🚨 Breaking changes
17+
18+
- Performance: use_reducer now skips re-rendering for the same Rc. [[@Pascal Sommer](https://github.com/Pascal-So), [#3945](https://github.com/yewstack/yew/pull/3945)]
19+
NOTE: Whether this is breaking is arguable. It merely breaks the promise that a dispatch will always cause a re-render. For code that wishes to force re-render, [use_force_update](https://docs.rs/yew/latest/yew/functional/fn.use_force_update.html) helps.
20+
21+
## ✨ yew-router **0.20.0** *(2026-03-10)*
22+
23+
Yew pinned to 0.23 now.
24+
25+
### 🛠 Fixes
26+
27+
- '/' is no longer wrongly encoded in wildcard route segments. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4056](https://github.com/yewstack/yew/pull/4056)]
28+
- Fixed a url corruption issue causing redirection to `/basename//basename` resulting in a 404. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4030](https://github.com/yewstack/yew/pull/4030)]
29+
30+
## ✨ yew-agent **0.5.0** *(2026-03-10)*
31+
32+
No changes.
33+
34+
Yew pinned to 0.23 now.
35+
336
## ✨ yew **0.22.1** *(2026-02-28)*
437

538
### 🛠 Fixes

website/docs/getting-started/build-a-sample-app.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ then take the following steps:
1313
### Checkout and customize project
1414

1515
```shell
16-
cargo generate --git https://github.com/yewstack/yew-trunk-minimal-template
16+
cargo generate yewstack/yew-trunk-minimal-template
1717
```
1818

1919
### Run project

website/docs/getting-started/editor-setup.mdx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,7 @@ impl Component for $NAME$ {
114114

115115
### JetBrains IDEs
116116

117-
JetBrains added experimental support for proc-macro expansion in April 2021.
118-
This feature must be enabled before it can be used.
119-
[See the blog post here.](https://blog.jetbrains.com/rust/2021/04/08/intellij-rust-updates-for-2021-1/#proc-macros)
120-
121-
This still won't enable HTML autofill and formatting help, although it will enable variable resolution for
122-
component names and attributes inside the macro.
123-
Utilities like Rename, Go to Declaration, Find Usages will work inside the macro.
117+
Contribution Welcome!
124118

125119
### VS Code
126120

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: 'From 0.4.0 to 0.5.0'
3+
---
4+
5+
No breaking changes. Update yew-agent to 0.5.0 in your `Cargo.toml`.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: 'From 0.19.0 to 0.20.0'
3+
---
4+
5+
No breaking changes. Update yew-router to 0.20.0 in your `Cargo.toml`.

website/docs/migration-guides/yew/from-0_18_0-to-0_19_0.mdx

Lines changed: 0 additions & 139 deletions
This file was deleted.
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
---
2+
title: 'From 0.22.0 to 0.23.0'
3+
---
4+
5+
import Tabs from '@theme/Tabs'
6+
import TabItem from '@theme/TabItem'
7+
8+
## `use_reducer` no longer re-renders on identity dispatches
9+
10+
`use_reducer` now skips re-rendering when the reducer returns the same `Rc` (checked by pointer equality). Previously, every dispatch triggered a re-render regardless.
11+
12+
If your reducer has a code path that returns `self` unchanged and you relied on that causing a re-render, replace it with `use_force_update`:
13+
14+
<Tabs>
15+
<TabItem value="before" label="Before" default>
16+
17+
```rust ,ignore
18+
use std::rc::Rc;
19+
use yew::prelude::*;
20+
21+
pub enum Action {
22+
Increment,
23+
ForceRefresh,
24+
}
25+
26+
struct State {
27+
count: u32,
28+
}
29+
30+
impl Reducible for State {
31+
type Action = Action;
32+
33+
fn reduce(self: Rc<Self>, action: Self::Action) -> Rc<Self> {
34+
match action {
35+
Action::Increment => Rc::new(Self {
36+
count: self.count + 1,
37+
}),
38+
// This no longer triggers a re-render in 0.23!
39+
Action::ForceRefresh => self,
40+
}
41+
}
42+
}
43+
44+
#[component]
45+
pub fn App() -> Html {
46+
use_effect(|| {
47+
tracing::info!("This cursed component does some effects on render");
48+
});
49+
let state = use_reducer(|| State { count: 0 });
50+
html! {
51+
<div>
52+
<p>{ state.count }</p>
53+
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "Refresh" }</button>
55+
</div>
56+
}
57+
}
58+
```
59+
60+
</TabItem>
61+
<TabItem value="after" label="After">
62+
63+
```rust ,ignore
64+
use std::rc::Rc;
65+
use yew::prelude::*;
66+
67+
pub enum Action {
68+
Increment,
69+
}
70+
71+
struct State {
72+
count: u32,
73+
}
74+
75+
impl Reducible for State {
76+
type Action = Action;
77+
78+
fn reduce(self: Rc<Self>, action: Self::Action) -> Rc<Self> {
79+
match action {
80+
Action::Increment => Rc::new(Self {
81+
count: self.count + 1,
82+
}),
83+
}
84+
}
85+
}
86+
87+
#[component]
88+
pub fn App() -> Html {
89+
use_effect(|| {
90+
tracing::info!("This cursed component does some effects on render");
91+
});
92+
let state = use_reducer(|| State { count: 0 });
93+
let trigger = use_force_update();
94+
html! {
95+
<div>
96+
<p>{ state.count }</p>
97+
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
98+
<button onclick={move |_| trigger.force_update()}>{ "Refresh" }</button>
99+
</div>
100+
}
101+
}
102+
```
103+
104+
</TabItem>
105+
</Tabs>

website/i18n/ja/docusaurus-plugin-content-docs/current/getting-started/build-a-sample-app.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ title: 'サンプルアプリケーションの構築'
99
[`cargo-generate`](https://github.com/cargo-generate/cargo-generate) のインストール手順に従ってツールをインストールし、次のコマンドを実行します:
1010

1111
```shell
12-
cargo generate --git https://github.com/yewstack/yew-trunk-minimal-template
12+
cargo generate yewstack/yew-trunk-minimal-template
1313
```
1414

1515
## 手動でアプリケーションを設定する

website/i18n/ja/docusaurus-plugin-content-docs/current/getting-started/editor-setup.mdx

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,7 @@ impl Component for $NAME$ {
112112

113113
### JetBrains IDEs
114114

115-
JetBrains は 2021 年 4 月にプロシージャルマクロ拡張の実験的サポートを追加しました。
116-
この機能を有効にする必要があります。
117-
[詳細については、このブログを参照してください。](https://blog.jetbrains.com/rust/2021/04/08/intellij-rust-updates-for-2021-1/#proc-macros)
118-
119-
これにより、HTML の自動補完やフォーマット支援は有効になりませんが、マクロ内のコンポーネント名やプロパティの変数解析が有効になります。
120-
リネーム、宣言へのジャンプ、使用箇所の検索などのツールがマクロ内で動作します。
115+
Contribution Welcome!
121116

122117
### VS Code
123118

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: '0.4.0 から 0.5.0 へ'
3+
---
4+
5+
破壊的変更はありません。`Cargo.toml` で yew-agent を 0.5.0 に更新してください。

0 commit comments

Comments
 (0)