Skip to content

Commit 32fcd32

Browse files
fix: correct migration guide clone pattern and update changelog (#4068)
1 parent acd2a33 commit 32fcd32

File tree

9 files changed

+84
-71
lines changed

9 files changed

+84
-71
lines changed

CHANGELOG.md

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,19 +4,24 @@
44

55
bumping from 0.22 should require no code changes for most users.
66

7-
### 🛠 Fixes
7+
### 🚨 Breaking changes
88

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)]
9+
- 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)]
10+
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. Please refer to [the migration guide](https://yew.rs/docs/next/migration-guides/yew/from-0_22_0-to-0_23_0) for details.
1111

1212
### ⚡️ Features
1313

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)]
14+
- `&str` and `String` can now be used for props of type `Option<Html>`. [[@Cashew](https://github.com/Casheeew), [#4020](https://github.com/yewstack/yew/pull/4020)]
15+
- Added a `scheduler::flush` function to reliably finish rendering. Useful in testing as a replacement for timeouts. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4044](https://github.com/yewstack/yew/pull/4044)]
1516

16-
### 🚨 Breaking changes
17+
### 🛠 Fixes
1718

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.
19+
- No more broken child re-renders while setting parents' states. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4060](https://github.com/yewstack/yew/pull/4060)]
20+
- 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)]
21+
22+
### ⚙️ Improvements
23+
24+
- Yew's scheduler now yields to the main thread from time to time. This fix will make the web page more responsive and reduce warnings about long tasks in the console. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#4033](https://github.com/yewstack/yew/pull/4033)]
2025

2126
## ✨ yew-router **0.20.0** *(2026-03-10)*
2227

website/docs/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ If your reducer has a code path that returns `self` unchanged and you relied on
1515
<TabItem value="before" label="Before" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "Refresh" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "Refresh" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="After">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/ja/docusaurus-plugin-content-docs/current/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="変更前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "リフレッシュ" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "リフレッシュ" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="変更後">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/ja/docusaurus-plugin-content-docs/version-0.23/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="変更前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "リフレッシュ" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "リフレッシュ" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="変更後">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/zh-Hans/docusaurus-plugin-content-docs/current/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="之前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "刷新" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "刷新" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="之后">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/zh-Hans/docusaurus-plugin-content-docs/version-0.23/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="之前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "刷新" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "刷新" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="之后">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/zh-Hant/docusaurus-plugin-content-docs/current/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="之前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "重新整理" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "重新整理" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="之後">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/i18n/zh-Hant/docusaurus-plugin-content-docs/version-0.23/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ import TabItem from '@theme/TabItem'
1515
<TabItem value="before" label="之前" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "重新整理" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "重新整理" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="之後">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

website/versioned_docs/version-0.23/migration-guides/yew/from-0_22_0-to-0_23_0.mdx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,6 @@ If your reducer has a code path that returns `self` unchanged and you relied on
1515
<TabItem value="before" label="Before" default>
1616

1717
```rust ,ignore
18-
use std::rc::Rc;
19-
use yew::prelude::*;
20-
2118
pub enum Action {
2219
Increment,
2320
ForceRefresh,
@@ -50,8 +47,15 @@ pub fn App() -> Html {
5047
html! {
5148
<div>
5249
<p>{ state.count }</p>
53-
<button onclick={move |_| state.dispatch(Action::Increment)}>{ "+1" }</button>
54-
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>{ "Refresh" }</button>
50+
<button onclick={
51+
let state = state.clone();
52+
move |_| state.dispatch(Action::Increment)
53+
}>
54+
{ "+1" }
55+
</button>
56+
<button onclick={move |_| state.dispatch(Action::ForceRefresh)}>
57+
{ "Refresh" }
58+
</button>
5559
</div>
5660
}
5761
}
@@ -61,9 +65,6 @@ pub fn App() -> Html {
6165
<TabItem value="after" label="After">
6266

6367
```rust ,ignore
64-
use std::rc::Rc;
65-
use yew::prelude::*;
66-
6768
pub enum Action {
6869
Increment,
6970
}

0 commit comments

Comments
 (0)