Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Leptos Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-leptos-knowledge-patch)
---
name: leptos-knowledge-patch
description: Leptos
version: "0.8.23"
license: MIT
metadata:
author: Nevaberry
---
# Leptos Knowledge Patch
Load this skill when updating Leptos applications or working with components,
reactivity, routing, server functions, lazy loading, SSR, and `cargo-leptos`.
Use the topic references for complete guidance and examples. Advice that depends
on a particular release names that release beside the relevant behavior.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migration and configuration](references/migration-and-configuration.md) | Custom conversion traits, options construction and string fields, Axum dependency changes, independent crate versions, stylesheet paths |
| [Reactivity, resources, and stores](references/reactivity-and-stores.md) | Signal calls, batching, selectors, resource values and dependencies, effects, serialization, store notifications, error boundaries |
| [Routing, SSR, and integrations](references/routing-ssr-and-integrations.md) | Protected routes, transitions, parameters, islands, fallbacks, redirects, router state, forms, CSP nonces, hydration scripts |
| [Server functions and lazy loading](references/server-functions-and-lazy-loading.md) | Result types, WebSockets, Actix support, encodings, limits, server URLs, lazy macros, lazy routes, preloading |
| [Views, components, and browser APIs](references/views-components-and-browser.md) | Attribute spreading and interception, radio binding, props, recursive components, optional rendering, DOM helpers, events, keyed hydration |
| [cargo-leptos](references/cargo-leptos.md) | Prebuilt installers and archives, development component erasure, stable hot reloading, source locations, live-reload protocol |
## Migration priorities
### Custom rendering and configuration
Implement `IntoRender` for custom values used as view children and
`IntoAttributeValue` for custom HTML attribute values. Migrate existing
`IntoView` and `IntoAttribute` implementations for those uses to the corresponding
new traits.
The former `String` fields in `LeptosOptions` now use `Arc<str>`.
Pass `field.as_ref()` to APIs that need a `&str`.
Replace `LeptosOptions::default()` and `ConfFile::default()` with explicit
construction or load the options with `get_configuration(None)?.leptos_options`.
### Dependency and integration changes
Upgrade Axum to 0.8 alongside `leptos_axum` so their Axum types match.
For paths registered directly on Axum's router, use brace syntax such as
`/posts/{id}` and `/files/{*rest}`.
Starting in 0.8.6, Leptos workspace crates receive patch releases independently.
Choose the published version of each crate when pinning dependencies.
In 0.9.0-beta, `render_app_async_stream_with_context` was removed.
Update integrations that call it directly.
### Reactive value migrations
Remove `batch` calls and run their bodies directly; reactive updates batch
automatically. For immediate effects, starting in 0.8.11,
`effect::immediate::batch(|| { /* signal writes */ })` defers those effects until
the batch finishes.
`LocalResource` exposes values directly. Remove dereferences that existed solely
to unwrap `SendWrapper`. Update action code that explicitly uses the former
`SendOption` wrapper to work with an ordinary `Option`.
Pass keys to `Selector::selected` by reference: `selector.selected(&key)`.
### Signal and browser API changes in beta
In 0.9.0-beta, signals dereference to callable values on stable and nightly Rust.
Change props accepting both signals and closures from `impl Fn() -> T` to
`impl SignalOrFn<Output = T>`: signals no longer implement the `Fn` traits
directly on nightly.
In 0.9.0-beta, `on:toggle` receives a `ToggleEvent`.
Update callbacks that explicitly take a plain `Event`.
In 0.9.0-beta, switch calls to handle-returning DOM helpers from the
`_with_handle` names to their unsuffixed names.
### Lazy loading and form encoding in beta
In 0.9.0-beta, enable the `lazy` feature on the `leptos` dependency to continue
using lazy loading and WASM code splitting.
```toml
[dependencies]
leptos = { version = "0.9.0-beta", features = ["lazy"] }
```
The default URL-encoded server-function input in 0.9.0-beta uses `serde_qs` 1.0.
Retest empty collections: they may decode without the `#[server(default)]`
workarounds used with the older codec.
## Resources, signals, and stores
Starting in 0.8.3, use `Resource::write()` to mutate a resource's stored value
directly. Put reactive reads that should trigger a refetch in the source closure
passed to `Resource::new`; reads inside the fetcher's `async` block are untracked.
Starting in 0.8.14, closure-to-wrapper `From` conversions are available again for
types including `Signal`, `ArcSignal`, and `Callback`:
`let label: Signal<&str> = (|| "Ready").into();`.
Starting in 0.8.16, deserialize directly into `Signal<T>` when `T` implements
Serde's `Deserialize`.
Starting in 0.8.19, a patch that changes the structure of a keyed collection
notifies subscribers of the structural change.
In 0.8.21, errors inside a `<Suspense>` tracking only `LocalResource` values reach
the enclosing `<ErrorBoundary>`. Resource-read checks also apply when an HTML
attribute gets its value from a `Signal` or `Memo` that reads a resource.
## Components and HTML attributes
Use `attr:` for individual HTML attributes, or put `{..}` after component props
to treat subsequent entries as attributes. Spread attributes apply to each root
element the component renders and can pass through wrappers such as `Suspense`.
```rust
view! { <A href="/" attr:aria-label="Home" {..} class="nav-link">"Home"</A> }
```
Starting in 0.7.1, `<AttributeInterceptor>` captures spread attributes and
forwards them to a chosen element inside a wrapper component.
Use `bind:group` with the same writable `String` signal on each radio input.
The signal holds the selected input's `value`.
```rust
let delivery = RwSignal::new(String::from("email"));
view! {
<input type="radio" name="delivery" value="email" bind:group=delivery />
<input type="radio" name="delivery" value="post" bind:group=delivery />
}
```
End a recursive component's returned view with `.into_any()` so the compiler can
determine the size of the view tree.
Starting in 0.8.8, `<ShowLet>` renders the value inside a reactive `Option` and
uses its fallback for `None`. Starting in 0.8.15, it also accepts a plain `Option`.
Starting in 0.7.5, pass a `TextProp` directly as an HTML attribute value, such as
`title=tooltip`. Starting in 0.8.16, `MaybeProp` implements `AttributeValue` and
can also be passed directly as an HTML attribute value.
Starting in 0.8.21, convert a reactive store subfield directly into a `MaybeProp`,
for example `let tooltip: MaybeProp<String> = store.tooltip().into();`.
## Routing and parameters
`<ProtectedRoute>` reevaluates its condition as reactive state changes and uses
`Suspense` to support resource-backed conditions.
Set `transition=true` on `<Routes>` or `<FlatRoutes>` to use the browser View
Transition API during navigation. On `<html>`, target `.routing-progress` while
navigating, `.router-back` for back navigation, and `.router-outlet-0`,
`.router-outlet-1`, and so on for the depth of the changing outlet.
`ParamsMap` can preserve repeated query values such as `?tag=rust&tag=wasm`.
Its API distinguishes adding from replacing values and reading one from reading
all values. Starting in 0.8.16, `for entry in ¶ms` retains the map for later use.
Starting in 0.7.5, `#[derive(Params)]` supports raw identifiers such as `r#type`.
Starting in 0.8.16, the derive works without a nightly toolchain.
Enable `islands-router` for client-side navigation in an islands app while
hydrating its interactive islands.
Server-rendered router fallbacks can set a custom HTTP status or redirect.
In an Axum fallback, set the status through `leptos_axum::ResponseOptions`.
## Server functions and code splitting
A `#[server]` function can return `Result<T, AppError>` when `AppError` implements
`FromServerFnError`. The macro also accepts aliases such as
`type ApiResult<T> = Result<T, AppError>` in the function signature.
Select `Websocket<InputEncoding, OutputEncoding>` as the protocol and accept and
return `BoxedStream` values. Open the connection from client-side code and consume
the returned stream for incoming messages.
Starting in 0.8.19, primary non-multipart server-function encodings honor the web
framework's request-body limit. For large requests, adjust Axum's
`DefaultBodyLimit` or Actix's `PayloadConfig`.
The `#[lazy]` macros add lazy loading and code splitting in 0.7.5.
Starting in 0.8.5, implement `LazyRoute` with `#[lazy_route]` to split route code
for WASM. The router starts loading the route's data and view concurrently,
including for nested routes. Starting in 0.8.6, put `#[server]` above `#[lazy]`
on a server function to split its client-side WASM code.
Starting in 0.8.19, `lazy_preload!` can start loading a `#[lazy]` function's WASM
code ahead of the call.
## SSR and development
Switch from `<Stylesheet>` to `<HashedStylesheet>` when using `cargo-leptos`
stylesheet hashing. Starting in 0.8.18, `LeptosOptions::css_file_path()` resolves
the generated stylesheet's path on disk.
Starting in 0.8.19 and 0.9.0-beta, use `Nonce::from_value` to bring an existing CSP
nonce into Leptos. Use the same nonce in the CSP header and rendered markup.
In 0.8.21, `use_nonce()` is available even when the `nonce` Cargo feature is
disabled, and the generated WebAssembly preload uses the active CSP nonce.
Starting in 0.8.23, request deferred script execution in the server-rendered
document shell:
```rust
view! { <HydrationScripts options defer=true /> }
```
The `cargo-leptos` release paired with Leptos 0.8.0 enables
`--cfg=erase_components` for development by default. With Trunk, set the flag
explicitly for development builds. View hot reloading works on stable Rust
starting in 0.8.4.