docs: 0.22.0 prep (#3952)

This commit is contained in:
Siyuan Yan 2025-12-08 07:52:29 +09:00 committed by GitHub
parent 54c20db6cf
commit 610f931e22
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 397 additions and 31 deletions

View File

@ -1,55 +1,101 @@
# Changelog
## ✨ yew **0.22.0** *(2024-10-14)*
## ✨ yew **0.22.0** *(2025-12-08)*
#### Changelog
## 🛠 Fixes
- Fix: Hydratation of empty lists next to components.. [[@WorldSEnder](https://github.com/WorldSEnder), [#3630](https://github.com/yewstack/yew/pull/3630)]
silenced non-normalised element name warnings for SVG elements [@Tim Kurdov](https://github.com/its-the-shrimp), [#3769](https://github.com/yewstack/yew/pull/3769)]
## ⚡️ Features
- Raise MSRV to 1.76. [[@Elina](https://github.com/ranile), [#3693](https://github.com/yewstack/yew/pull/3693)]
- Add `inert` to the boolean attributes list. [[@Tomoaki Kawada](https://github.com/kawadakk), [#3678](https://github.com/yewstack/yew/pull/3678)]
- Namespace support for `VRaw`.. [[@Finn Bear](https://github.com/finnbear), [#3640](https://github.com/yewstack/yew/pull/3640)]
- Add generic type hints to boxed hooks. [[@Michael Meyer](https://github.com/Ichmed), [#3633](https://github.com/yewstack/yew/pull/3633)]
- add the methods and From impls. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3519](https://github.com/yewstack/yew/pull/3519)]
- Add IntoPropValue impl for converting to VList. [[@Muhammad Hamza](https://github.com/ranile), [#3444](https://github.com/yewstack/yew/pull/3444)]
- Add CallbackRef that takes ref in argument instead of value. [[@Cecile Tonglet](https://github.com/cecton), [#3419](https://github.com/yewstack/yew/pull/3419)]
- Remove the dependency on `boolinator`. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3420](https://github.com/yewstack/yew/pull/3420)]
- Allow import of layout_test into 3rd party crates. [[@rollo-b2c2](https://github.com/rollo-b2c2), [#3463](https://github.com/yewstack/yew/pull/3463)]
- Add WASI support for server-side rendering. [[@langyo](https://github.com/langyo), [#3534](https://github.com/yewstack/yew/pull/3534)]
## 🚨 Breaking changes
- Add use_ref. [[@Alex Parrill](https://github.com/ColonelThirtyTwo), [#3548](https://github.com/yewstack/yew/pull/3548)]
- **MSRV raised to 1.84.0.** [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3900](https://github.com/yewstack/yew/pull/3900)]
- Allow setting JsValue as properties. [[@Elina](https://github.com/ranile), [#3458](https://github.com/yewstack/yew/pull/3458)]
- Remove deprecated `class=(...)` syntax. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3497](https://github.com/yewstack/yew/pull/3497)]
- Remove ToHtml trait. [[@Elina](https://github.com/ranile), [#3453](https://github.com/yewstack/yew/pull/3453)]
- Make Html (VNode) cheap to clone. [[@Cecile Tonglet](https://github.com/cecton), [#3431](https://github.com/yewstack/yew/pull/3431)]
- Make `<textarea>` a void element (no children allowed anymore). [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3465](https://github.com/yewstack/yew/pull/3465)]
## ✨ yew-router **0.19.0** *(2024-10-14)*
## ⚡️ Features
- **Add for-loops to `html!` macro.** [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3498](https://github.com/yewstack/yew/pull/3498)]
- **Rename `#[function_component]` to `#[component]`.** [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3885](https://github.com/yewstack/yew/pull/3885)]
- Add `serde` feature to yew. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3880](https://github.com/yewstack/yew/pull/3880)]
- Add `use_ref` hook. [[@Alex Parrill](https://github.com/ColonelThirtyTwo), [#3548](https://github.com/yewstack/yew/pull/3548)]
- Better ImplicitClone ergonomics. Fewer ampersands and stars needed in the `html!` macro. [[@Cecile Tonglet](https://github.com/cecton), [#3508](https://github.com/yewstack/yew/pull/3508), [#3431](https://github.com/yewstack/yew/pull/3431)] [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3892](https://github.com/yewstack/yew/pull/3878)]
- Preserve camelCase for known SVG elements. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3875](https://github.com/yewstack/yew/pull/3875)]
- Add `inert` to the boolean attributes list. [[@Tomoaki Kawada](https://github.com/kawadakk), [#3678](https://github.com/yewstack/yew/pull/3678)]
- Namespace support for `VRaw`. [[@Finn Bear](https://github.com/finnbear), [#3640](https://github.com/yewstack/yew/pull/3640)]
- `to_callback` methods and From impls to convert reducer dispatchers and state setters to callbacks. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3519](https://github.com/yewstack/yew/pull/3519)]
- Allows converting `ChildrenRenderer<VNode>` and `VChild` to VList. [[@Muhammad Hamza](https://github.com/ranile), [#3444](https://github.com/yewstack/yew/pull/3444)]
- Add `CallbackRef` that takes ref in argument instead of value. [[@Cecile Tonglet](https://github.com/cecton), [#3419](https://github.com/yewstack/yew/pull/3419)]
- Allow import of layout_test into 3rd party crates. [[@rollo-b2c2](https://github.com/rollo-b2c2), [#3463](https://github.com/yewstack/yew/pull/3463)]
- Add WASI support for server-side rendering. [[@langyo](https://github.com/langyo), [#3534](https://github.com/yewstack/yew/pull/3534)]
- Make `UseFutureHandle` Clone. [[@Adam Steinberg](https://github.com/AdamSteinberg1), [#3529](https://github.com/yewstack/yew/pull/3529)]
- Allow `Self` in prop fields. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3569](https://github.com/yewstack/yew/pull/3569)]
- Allow boolean in `html!`. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3441](https://github.com/yewstack/yew/pull/3441)]
## 🛠 Fixes
- Fix panic when hydrating components with unstable render order. [[@WorldSEnder](https://github.com/WorldSEnder), [#3914](https://github.com/yewstack/yew/pull/3914)]
- Fix hydration panic on camelCased elements. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3876](https://github.com/yewstack/yew/pull/3876)]
- Fix autocompletion in html macro for rust-analyzer. [[@Moritz Hedtke](https://github.com/mohe2015), [#3829](https://github.com/yewstack/yew/pull/3829)]
- Fix empty lists hydration failure when they were placed next to suspensions and other components. [[@WorldSEnder](https://github.com/WorldSEnder), [#3630](https://github.com/yewstack/yew/pull/3630)]
- Silenced non-normalised element name warnings for SVG elements. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3769](https://github.com/yewstack/yew/pull/3769)]
- Fixed inconsistent clone() requirement when passing Classes to HTML elements vs. components. [[@Siddhant Shekhar](https://github.com/sshekhar563), [#3931](https://github.com/yewstack/yew/pull/3931)]
- Fix svg animation always starting immediately. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3892](https://github.com/yewstack/yew/pull/3892)]
- Better diagnostics for byte literals in `html!`. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3441](https://github.com/yewstack/yew/pull/3441)]
- Concise diagnostics for missing props. [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3873](https://github.com/yewstack/yew/pull/3873)]
- Use the namespace when xmlns attributes are specified. [[@JasonCG](https://github.com/jasoncg), [#3629](https://github.com/yewstack/yew/pull/3629)]
- Fix generic type missing erros in hooks. [[@Michael Meyer](https://github.com/Ichmed), [#3633](https://github.com/yewstack/yew/pull/3633)]
- Better duplicate key diagnostics. [[@WorldSEnder](https://github.com/WorldSEnder), [#3785](https://github.com/yewstack/yew/pull/3785)]
- Fix autocompletion in html macro for rust-analyzer. [[@Moritz Hedtke](https://github.com/mohe2015), [#3829](https://github.com/yewstack/yew/pull/3829)]
- `#[hook]`: `clippy::multiple_bound_locations` lint no longer triggered. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3803](https://github.com/yewstack/yew/pull/3803)]
## ⚙️ Improvements
- Avoid unnecessary scheduling. [[@WorldSEnder](https://github.com/WorldSEnder), [#3935](https://github.com/yewstack/yew/pull/3935)]
- Remove the dependency on `boolinator`. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3420](https://github.com/yewstack/yew/pull/3420)]
- Avoid string copy for Key: From<String> implementation. [[@flumm](https://github.com/flumm), [#3858](https://github.com/yewstack/yew/pull/3858)]
- Switch to tokise from tokio [[@Elina](https://github.com/ranile), [#3776](https://github.com/yewstack/yew/pull/3776)]
- use_future_with: simplify code a bit by using read-only use_memo rather than use_state. [[@Léo Gaspard](https://github.com/Ekleog), [#3610](https://github.com/yewstack/yew/pull/3610)]
## 📝 Documentation
- website: modernise the Yew usage in the tutorial. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3882](https://github.com/yewstack/yew/pull/3882)]
- website: make tutorial testable. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3879](https://github.com/yewstack/yew/pull/3879)]
- fix the docs of use_prepared_state. [[@Tim Kurdov](https://github.com/its-the-shrimp), [#3881](https://github.com/yewstack/yew/pull/3881)]
- Update tutorial placeholder image generator. [[@Nashwan Azhari](https://github.com/aznashwan), [#3830](https://github.com/yewstack/yew/pull/3830)]
- Refactor(NavbarItem): improve readability and maintainability. [[@Brilliantkid](https://github.com/brilliantkid87), [#3763](https://github.com/yewstack/yew/pull/3763)]
- Fix website search. [[@Muhammad Hamza](https://github.com/ranile), [#3522](https://github.com/yewstack/yew/pull/3522)]
- Addition and improvements to example crates. [[@Oliver Bilbie](https://github.com/Oliver-Bilbie), [#3587](https://github.com/yewstack/yew/pull/3587)] [[@Astariul](https://github.com/astariul), [#3631](https://github.com/yewstack/yew/pull/3631)] [[@Yann Dirson](https://github.com/ydirson), [#3570](https://github.com/yewstack/yew/pull/3570)] [[@Cecile Tonglet](https://github.com/cecton), [#3505](https://github.com/yewstack/yew/pull/3505)] [[@Kaede Hoshikawa](https://github.com/futursolo), [#3436](https://github.com/yewstack/yew/pull/3436)]
- Wording and typo fixes. [[@Waldir Pimenta](https://github.com/waldyrious), [#3754](https://github.com/yewstack/yew/pull/3754)] [[@Jupp56](https://github.com/Jupp56), [#3429](https://github.com/yewstack/yew/pull/3429)] [[@Flavio Moreira](https://github.com/fdvmoreira), [#3418](https://github.com/yewstack/yew/pull/3418)] [[@ronanM](https://github.com/ronanM), [#3413](https://github.com/yewstack/yew/pull/3413)] [[@Waldir Pimenta](https://github.com/waldyrious), [#3754](https://github.com/yewstack/yew/pull/3754)] [[@Damien Lachaume](https://github.com/dlachaume), [#3790](https://github.com/yewstack/yew/pull/3790)] [[@Edwin Amsler](https://github.com/RandomInsano), [#3788](https://github.com/yewstack/yew/pull/3788)] [[@Tushar GH](https://github.com/Tushar12222), [#3585](https://github.com/yewstack/yew/pull/3585)] [[@zhengwu](https://github.com/rockyzhengwu), [#3574](https://github.com/yewstack/yew/pull/3574)] [[@Raahim Fareed](https://github.com/raahimfareed), [#3539](https://github.com/yewstack/yew/pull/3539)] [[@gcmutator](https://github.com/gcmutator), [#3628](https://github.com/yewstack/yew/pull/3628)] [[@Raphael Martin Schindler](https://github.com/rmschindler), [#3605](https://github.com/yewstack/yew/pull/3605)] [[@Jonathan Picques](https://github.com/JonathanPicques), [#3448](https://github.com/yewstack/yew/pull/3448)] [[@Ikko Eltociear Ashimine](https://github.com/eltociear), [#3432](https://github.com/yewstack/yew/pull/3432)] [[@Daniel Sousa](https://github.com/moyeah), [#3425](https://github.com/yewstack/yew/pull/3425)]
## ✨ yew-router **0.19.0** *(2025-12-08)*
#### Changelog
## ⚡️ Features
- Introduce `FromQuery` and `IntoQuery` traits. [[@Robert Schütte](https://github.com/Roba1993), [#3565](https://github.com/yewstack/yew/pull/3565)]
- Dynamic basename support. [[@Finn Bear](https://github.com/finnbear), [#3725](https://github.com/yewstack/yew/pull/3725)]
## 🚨 Breaking changes
- **MSRV raised to 1.84.0.** [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3900](https://github.com/yewstack/yew/pull/3900)]
## ✨ yew-agent **0.4.0** *(2025-12-08)*
#### Changelog
## 🛠 Fixes
- Fix CI. [[@Tomoaki Kawada](https://github.com/kawadakk), [#3679](https://github.com/yewstack/yew/pull/3679)]
- Fix calls of the disconnected method of on every render. [[@Shihpin Tseng](https://github.com/deftsp), [#3435](https://github.com/yewstack/yew/pull/3435)]
## ⚡️ Features
- Raise MSRV to 1.76. [[@Elina](https://github.com/ranile), [#3693](https://github.com/yewstack/yew/pull/3693)]
- **Support module type web worker.** [[@Luca Cappelletti](https://github.com/LucaCappelletti94), [#3859](https://github.com/yewstack/yew/pull/3859)]
## ✨ yew-agent **0.4.0** *(2024-10-14)*
## 🚨 Breaking changes
#### Changelog
## ⚡️ Features
- Raise MSRV to 1.76. [[@Elina](https://github.com/ranile), [#3693](https://github.com/yewstack/yew/pull/3693)]
- Agent: Avoiding clone of WorkerBridge and WorkerProviderState. [[@Shihpin Tseng](https://github.com/deftsp), [#3435](https://github.com/yewstack/yew/pull/3435)]
- **MSRV raised to 1.84.0.** [[@Siyuan Yan](https://github.com/Madoshakalaka), [#3900](https://github.com/yewstack/yew/pull/3900)]
----

View File

@ -0,0 +1 @@
tag = false

View File

@ -0,0 +1,101 @@
---
title: Yew 0.22 - For Real This Time
authors: [mattuwu]
---
The Yew team is thrilled to announce the release of Yew 0.22! After a longer-than-expected journey, this release brings significant improvements to ergonomics, performance, and developer experience.
<!--truncate-->
## Highlights
### New `#[component]` Attribute
The `#[function_component]` attribute has been renamed to `#[component]` for brevity:
```rust
// Before
#[function_component]
fn MyComponent() -> Html {
html! { <div>{"Hello!"}</div> }
}
// After (0.22+)
#[component]
fn MyComponent() -> Html {
html! { <div>{"Hello!"}</div> }
}
```
The old `#[function_component]` attribute is deprecated but still works, giving you time to migrate.
### For-Loops in `html!`
You can now use for-loops directly in the `html!` macro, making iteration more natural:
```rust
// Before - using iterator adapters
html! {
<ul>
{ for items.iter().map(|item| html! { <li>{ item }</li> }) }
</ul>
}
// After (0.22+) - native for-loop syntax
html! {
<ul>
for item in items {
<li>{ item }</li>
}
</ul>
}
```
### MSRV Raised to 1.84.0
The minimum supported Rust version is now **1.84.0**. This allows us to use newer language features and provide better error messages.
### WASI Support for SSR
Server-side rendering now works on WASI targets. See the [original 0.22 announcement](/blog/2024/10/14/release-0-22) for details.
### Better Cloning Ergonomics
- `ImplicitClone` is implemented for more yew types. This means less `&` and `*` and `.clone()` clutter in the html macro.
### yew-agent: Vendored gloo-workers
The `yew-agent` crate now includes its own web worker implementation, removing the external dependency on `gloo-worker`. This also adds support for **module-type web workers**:
```rust
let spawner = WorkerSpawner::<MyWorker>::new()
.as_module(true) // Use ES module workers
.spawn();
```
### yew-router: Query Parameter Traits
The `FromQuery` and `ToQuery` traits from gloo are now re-exported via `yew_router::query` for more flexible query parameter handling, along with dynamic basename support.
## Migration Guide
See the [migration guide](/docs/next/migration-guides/yew/from-0_21_0-to-0_22_0) for detailed instructions on upgrading from 0.21.
## Contributors
Many thanks to everyone who contributed to this release! Special thanks to:
- [@WorldSEnder](https://github.com/WorldSEnder) for hydration fixes
- [@its-the-shrimp](https://github.com/its-the-shrimp) for html macro enhancements
- [@Kirill Semyonkin](https://github.com/kirillsemyonkin) for implicit clone library improvements
- [@langyo](https://github.com/langyo) for WASI SSR support
- [@cecton](https://github.com/cecton) for implicit clone improvements and ergonomics
- [@ranile](https://github.com/ranile) for property improvements
And all the other contributors who helped make this release possible!
## What's Next
We're continuing to work on improving Yew's performance, developer experience, and documentation. Join us on [Discord](https://discord.gg/VQck8X4) to get involved!
See the [full changelog](https://github.com/yewstack/yew/blob/master/CHANGELOG.md) for all changes.

View File

@ -9,3 +9,9 @@ langyo:
title: Contributor of Yew
url: https://github.com/langyo
image_url: https://github.com/langyo.png
mattuwu:
name: Mattuwu
title: Maintainer of Yew
url: https://github.com/Madoshakalaka
image_url: https://github.com/Madoshakalaka.png

View File

@ -0,0 +1,41 @@
---
title: 'From 0.3.0 to 0.4.0'
---
## MSRV raised to 1.84.0
The minimum supported Rust version is now **1.84.0**. Update your toolchain:
```bash
rustup update stable
```
## gloo-worker vendored
The external dependency on `gloo-worker` has been removed. All worker functionality is now built into `yew-agent`.
### Update imports
If you were importing types from `gloo-worker`, update to import from `yew_agent`:
```rust ,ignore
// Before
use gloo_worker::{Spawnable, Worker, WorkerScope};
// After
use yew_agent::prelude::*;
// or
use yew_agent::{Spawnable, Worker, WorkerScope};
```
### Codec trait
The `Codec` trait is now defined in `yew-agent`:
```rust ,ignore
// Before
use gloo_worker::Codec;
// After
use yew_agent::Codec;
```

View File

@ -0,0 +1,169 @@
---
title: 'From 0.21.0 to 0.22.0'
---
import Tabs from '@theme/Tabs'
import TabItem from '@theme/TabItem'
## MSRV raised to 1.84.0
The minimum supported Rust version is now **1.84.0**. Update your toolchain:
```bash
rustup update stable
```
## `#[function_component]` renamed to `#[component]`
The `#[function_component]` attribute has been renamed to `#[component]` for brevity. The old name is deprecated but still works.
### Automated refactor
```bash
# Using sed (simple but also replaces in comments/strings)
find . -name "*.rs" -exec sed -i 's/#\[function_component\]/#[component]/g' {} +
find . -name "*.rs" -exec sed -i 's/#\[function_component(/#[component(/g' {} +
# Or using ast-grep (recommended - AST-aware, preserves comments/strings)
# Important: Run the named pattern FIRST to preserve component names
ast-grep run -p '#[function_component($$$ARGS)]' -r '#[component($$$ARGS)]' -l rust --update-all .
ast-grep run -p '#[function_component]' -r '#[component]' -l rust --update-all .
```
:::note
The sed commands will also replace occurrences in comments and strings. Use ast-grep for more precise refactoring.
:::
<Tabs>
<TabItem value="before" label="Before" default>
```rust ,ignore
#[function_component]
fn MyComponent() -> Html {
html! { <div>{"Hello"}</div> }
}
#[function_component(Named)]
fn AnotherComponent() -> Html {
html! { <div>{"World"}</div> }
}
```
</TabItem>
<TabItem value="after" label="After">
```rust ,ignore
#[component]
fn MyComponent() -> Html {
html! { <div>{"Hello"}</div> }
}
#[component(Named)]
fn AnotherComponent() -> Html {
html! { <div>{"World"}</div> }
}
```
</TabItem>
</Tabs>
## `class=(...)` syntax removed
The deprecated `class=(expr)` syntax has been removed. Use `class={classes!(...)}` instead.
### Finding occurrences
```bash
# Find all files using the old class=(...) syntax
grep -rn "class=(" --include="*.rs" .
```
### Manual refactor
The transformation is straightforward: wrap the tuple contents with `classes!()` and change parentheses to braces:
- `class=(a, b)` → `class={classes!(a, b)}`
- `class=(expr)` → `class={classes!(expr)}`
<Tabs>
<TabItem value="before" label="Before" default>
```rust ,ignore
html! {
<div class=(some_class, other_class)>{"Content"}</div>
}
```
</TabItem>
<TabItem value="after" label="After">
```rust ,ignore
html! {
<div class={classes!(some_class, other_class)}>{"Content"}</div>
}
```
</TabItem>
</Tabs>
## `ToHtml` trait removed
The `ToHtml` trait has been removed. Use `IntoPropValue` for custom type conversions.
## For-loops in `html!` macro
You can now use for-loops directly in the `html!` macro. This is optional but provides cleaner syntax:
<Tabs>
<TabItem value="before" label="Before (still works)" default>
```rust ,ignore
html! {
<ul>
{ for items.iter().map(|item| html! { <li key={item.id}>{ &item.name }</li> }) }
</ul>
}
```
</TabItem>
<TabItem value="after" label="After (new syntax)">
```rust ,ignore
html! {
<ul>
for item in items {
<li key={item.id}>{ &item.name }</li>
}
</ul>
}
```
</TabItem>
</Tabs>
## `use_effect_with` no longer requires `|| ()` return
Effect hooks no longer require returning `|| ()` when there's no cleanup:
<Tabs>
<TabItem value="before" label="Before" default>
```rust ,ignore
use_effect_with(deps, |deps| {
// do something
|| () // had to return this
});
```
</TabItem>
<TabItem value="after" label="After">
```rust ,ignore
use_effect_with(deps, |deps| {
// do something
// no return needed!
});
```
</TabItem>
</Tabs>

View File

@ -154,6 +154,7 @@ module.exports = {
type: 'category',
label: 'yew',
items: [
'migration-guides/yew/from-0_21_0-to-0_22_0',
'migration-guides/yew/from-0_20_0-to-0_21_0',
'migration-guides/yew/from-0_19_0-to-0_20_0',
'migration-guides/yew/from-0_18_0-to-0_19_0',
@ -163,6 +164,7 @@ module.exports = {
type: 'category',
label: 'yew-agent',
items: [
'migration-guides/yew-agent/from-0_3_0-to-0_4_0',
'migration-guides/yew-agent/from-0_1_0-to-0_2_0',
'migration-guides/yew-agent/from-0_0_0-to-0_1_0',
],