Releases: leptos-rs/leptos
0.6.5
0.6.4
This fixes a few bugs that have popped up since 0.6.3. For general 0.6 migration notes, see here.
What's Changed
- chore: define
edtion = "2021"
inrustfmt.toml
by @chrisp60 in #2235 - fix: correctly track source in
create_local_resource
(closes #2237) by @gbj in #2238 - example: file upload with streaming progress bar by @gbj in #2242
- fix: serialization error during SSR on ServerFnError by @gbj in #2240
Full Changelog: v0.6.3...v0.6.4
0.6.3
This is release for our new server functions rewrite and Axum 0.7 support.
This should be a relatively feature-rich release, with limited breaking changes.
Migration
Actix
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree.
Axum
- This release supports Axum 0.7, so you'll need to migrate from Axum 0.6. The easiest way to do this is probably to consult the diff on one of the examples. (Note that along with Axum 0.7, you'll need to update to
http
1.0 andtower_http
0.5.) - You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree. RequestParts
has been removed, ashttp::request::Parts
now implementsClone
: anyuse_context::<RequestParts>()
should be updated to useParts
directly instead.
ServerFnError::new()
The addition of custom error types means that constructing ServerFnError
inside server functions can cause type inference errors:
let oops = Err(ServerFnError::ServerError("No server state".to_string()));
return oops; // this is fine
oops? // this is not: cannot infer type of the type parameter `E` declared on the enum `ServerFnError`
As a result, we've added a helper ServerFnError::new
which simply constructs a ServerFnError::<NoCustomError>::ServerError
:
let oops = Err(ServerFnError::new("No server state"));
return oops; // this is fine
oops? // this is also fine now
This has the benefit of being more concise than the earlier pattern in any case.
Features
A rewritten server function system that is backwards-compatible, but reduces binary size and increases flexibility, specifically by allowing
- automatic setup of server fn handlers with
.leptos_routes()
from the integrations - a variety of additional built-in encodings (rkyv, multipart forms/file uploads) in addition to the current set (GET URL, POST URL, CBOR, Rkyv) (#1868, #1989)
- support for streaming responses from server functions (#1284)
- ability to create custom user encodings for input and output by deriving
IntoReq
,FromReq
,IntoRes
, and/orFromRes
traits - ability to mix and match encodings easily: This server function should be a JSON POST request and a ByteStream response, this one should be GET URL request and an rkyv response, etc.; any combination of the encodings above is supported
- custom error types (#1657)
- a
#[middleware]
macro to add per-server-function middleware from the Tower or Actix ecosystems (#1461)
Note: The additional included encodings (serde_lite
, rkyv
, multipart form data) are all enabled by additive features on the server_fn
crate. If you want to use them you can just add that crate as a dependency and enable the required features.
Example: You can find a comprehensive example of these new features in the new server_fns_axum
example.
Full Changelog: v0.5.7...0.6.3
0.6.2
This is release for our new server functions rewrite and Axum 0.7 support.
This should be a relatively feature-rich release, with limited breaking changes.
Migration
Actix
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree.
Axum
- This release supports Axum 0.7, so you'll need to migrate from Axum 0.6. The easiest way to do this is probably to consult the diff on one of the examples. (Note that along with Axum 0.7, you'll need to update to
http
1.0 andtower_http
0.5.) - You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree. RequestParts
has been removed, ashttp::request::Parts
now implementsClone
: anyuse_context::<RequestParts>()
should be updated to useParts
directly instead.
ServerFnError::new()
The addition of custom error types means that constructing ServerFnError
inside server functions can cause type inference errors:
let oops = Err(ServerFnError::ServerError("No server state".to_string()));
return oops; // this is fine
oops? // this is not: cannot infer type of the type parameter `E` declared on the enum `ServerFnError`
As a result, we've added a helper ServerFnError::new
which simply constructs a ServerFnError::<NoCustomError>::ServerError
:
let oops = Err(ServerFnError::new("No server state"));
return oops; // this is fine
oops? // this is also fine now
This has the benefit of being more concise than the earlier pattern in any case.
Features
A rewritten server function system that is backwards-compatible, but reduces binary size and increases flexibility, specifically by allowing
- automatic setup of server fn handlers with
.leptos_routes()
from the integrations - a variety of additional built-in encodings (rkyv, multipart forms/file uploads) in addition to the current set (GET URL, POST URL, CBOR, Rkyv) (#1868, #1989)
- support for streaming responses from server functions (#1284)
- ability to create custom user encodings for input and output by deriving
IntoReq
,FromReq
,IntoRes
, and/orFromRes
traits - ability to mix and match encodings easily: This server function should be a JSON POST request and a ByteStream response, this one should be GET URL request and an rkyv response, etc.; any combination of the encodings above is supported
- custom error types (#1657)
- a
#[middleware]
macro to add per-server-function middleware from the Tower or Actix ecosystems (#1461)
Note: The additional included encodings (serde_lite
, rkyv
, multipart form data) are all enabled by additive features on the server_fn
crate. If you want to use them you can just add that crate as a dependency and enable the required features.
Example: You can find a comprehensive example of these new features in the new server_fns_axum
example.
Full Changelog: v0.5.7...0.6.2
0.6.1
This is release for our new server functions rewrite and Axum 0.7 support.
This should be a relatively feature-rich release, with limited breaking changes.
Migration
Actix
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree.
Axum
- This release supports Axum 0.7, so you'll need to migrate from Axum 0.6. The easiest way to do this is probably to consult the diff on one of the examples.
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree. RequestParts
has been removed, ashttp::request::Parts
now implementsClone
: anyuse_context::<RequestParts>()
should be updated to useParts
directly instead.
ServerFnError::new()
The addition of custom error types means that constructing ServerFnError
inside server functions can cause type inference errors:
let oops = Err(ServerFnError::ServerError("No server state".to_string()));
return oops; // this is fine
oops? // this is not: cannot infer type of the type parameter `E` declared on the enum `ServerFnError`
As a result, we've added a helper ServerFnError::new
which simply constructs a ServerFnError::<NoCustomError>::ServerError
:
let oops = Err(ServerFnError::new("No server state"));
return oops; // this is fine
oops? // this is also fine now
This has the benefit of being more concise than the earlier pattern in any case.
Features
A rewritten server function system that is backwards-compatible, but reduces binary size and increases flexibility, specifically by allowing
- automatic setup of server fn handlers with
.leptos_routes()
from the integrations - a variety of additional built-in encodings (rkyv, multipart forms/file uploads) in addition to the current set (GET URL, POST URL, CBOR, Rkyv) (#1868, #1989)
- support for streaming responses from server functions (#1284)
- ability to create custom user encodings for input and output by deriving
IntoReq
,FromReq
,IntoRes
, and/orFromRes
traits - ability to mix and match encodings easily: This server function should be a JSON POST request and a ByteStream response, this one should be GET URL request and an rkyv response, etc.; any combination of the encodings above is supported
- custom error types (#1657)
- a
#[middleware]
macro to add per-server-function middleware from the Tower or Actix ecosystems (#1461)
Note: The additional included encodings (serde_lite
, rkyv
, multipart form data) are all enabled by additive features on the server_fn
crate. If you want to use them you can just add that crate as a dependency and enable the required features.
Example: You can find a comprehensive example of these new features in the new server_fns_axum
example.
Full Changelog: v0.5.6...v0.6.1
0.6.0-rc1
This is prerelease for our new server functions rewrite and Axum 0.7 support.
This should be a relatively feature-rich release, with limited breaking changes.
I'm interested in gathering feedback in the discussion associated with this release.
Migration
Actix
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree.
Axum
- This release supports Axum 0.7, so you'll need to migrate from Axum 0.6. The easiest way to do this is probably to consult the diff on one of the examples.
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree. RequestParts
has been removed, ashttp::request::Parts
now implementsClone
: anyuse_context::<RequestParts>()
should be updated to useParts
directly instead.
ServerFnError::new()
The addition of custom error types means that constructing ServerFnError
inside server functions can cause type inference errors:
let oops = Err(ServerFnError::ServerError("No server state".to_string()));
return oops; // this is fine
oops? // this is not: cannot infer type of the type parameter `E` declared on the enum `ServerFnError`
As a result, we've added a helper ServerFnError::new
which simply constructs a ServerFnError::<NoCustomError>::ServerError
:
let oops = Err(ServerFnError::new("No server state"));
return oops; // this is fine
oops? // this is also fine now
This has the benefit of being more concise than the earlier pattern in any case.
Features
A rewritten server function system that is backwards-compatible, but reduces binary size and increases flexibility, specifically by allowing
- automatic setup of server fn handlers with
.leptos_routes()
from the integrations - a variety of additional built-in encodings (rkyv, multipart forms/file uploads) in addition to the current set (GET URL, POST URL, CBOR, Rkyv) (#1868, #1989)
- support for streaming responses from server functions (#1284)
- ability to create custom user encodings for input and output by deriving
IntoReq
,FromReq
,IntoRes
, and/orFromRes
traits - ability to mix and match encodings easily: This server function should be a JSON POST request and a ByteStream response, this one should be GET URL request and an rkyv response, etc.; any combination of the encodings above is supported
- custom error types (#1657)
- a
#[middleware]
macro to add per-server-function middleware from the Tower or Actix ecosystems (#1461)
Note: The additional included encodings (serde_lite
, rkyv
, multipart form data) are all enabled by additive features on the server_fn
crate. If you want to use them you can just add that crate as a dependency and enable the required features.
Example: You can find a comprehensive example of these new features in the new server_fns_axum
example.
What's Changed since 0.6.0-beta
- fix: ci stopped detecting leptos or example changes by @agilarity in #2194
- fix: routing regressions caused by
trailing_slash
support by @gbj in #2203 - examples: update
axum-session
because old version was yanked by @gbj in #2205 - docs:
View::render_to_string
panic by @chrisp60 in #2200 - fix:
leptos_meta
should not enabletracing
feature onleptos
by default (closes #2158) by @gbj in #2211 - feat:
Default
forLeptosOptions
,ConfFile
by @chrisp60 in #2208 - Make static rendered routes servable and provide context to static_params by @NiklasEi in #2207
- chore: minimize features activated with
leptos_axum
's default feature (#1846) by @gbj in #2213 - feat: add support for custom encoding to
#[server]
macro by @gbj in #2216 - fix:
.refetch()
should not include any tracked reads by @gbj in #2222
Full Changelog: v0.6.0-beta...0.6.0-rc1
v0.5.7
This has been a rocky week for releases. While finalizing the work on 0.6.0, I intended to publish a final 0.5.5 that would contain all the remaining changes to the 0.5 series. Unfortunately, this release contained two serious issues:
- breaking doc comments on server functions (fixed and rereleased in 0.5.6)
- The
trailing_slash
changes to the router in 0.5.5 broke the current routing behavior in several situations (see #2203 for details)
Because some (many?) existing 0.5 apps would break with this new feature under 0.5 β and worse, because they would compile and then either panic or display the wrong page β I decide to revert the feature immediately. This meant a semver-breaking change between 0.5.6 and 0.5.7, so I have yanked 0.5.5 and 0.5.6 of all the crates.
We've added some appropriate regression tests for those issues. Apologies to anyone whose work was affected by this!
v0.6.0-beta
This is a beta release for our new server functions rewrite and Axum 0.7 support.
This should be a relatively feature-rich release, with limited breaking changes.
I'm interested in gathering feedback in the discussion associated with this release.
Migration
Actix
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree.
Axum
- This release supports Axum 0.7, so you'll need to migrate from Axum 0.6. The easiest way to do this is probably to consult the diff on one of the examples.
- You can remove any explicit
.handle_server_fns()
call in yourmain.rs
, as server functions are now handled in.leptos_routes()
- The current
extract
function has been removed, and replaced with a newextract
that has the same API as the currentextractor
. I think this API is strictly better, but please share feedback if you disagree. RequestParts
has been removed, ashttp::request::Parts
now implementsClone
: anyuse_context::<RequestParts>()
should be updated to useParts
directly instead.
Features
A rewritten server function system that is backwards-compatible, but reduces binary size and increases flexibility, specifically by allowing
- automatic setup of server fn handlers with
.leptos_routes()
from the integrations - a variety of additional built-in encodings (rkyv, multipart forms/file uploads) in addition to the current set (GET URL, POST URL, CBOR, Rkyv) (#1868, #1989)
- support for streaming responses from server functions (#1284)
- ability to create custom user encodings for input and output by deriving
IntoReq
,FromReq
,IntoRes
, and/orFromRes
traits - ability to mix and match encodings easily: This server function should be a JSON POST request and a ByteStream response, this one should be GET URL request and an rkyv response, etc.; any combination of the encodings above is supported
- custom error types (#1657)
- a
#[middleware]
macro to add per-server-function middleware from the Tower or Actix ecosystems (#1461)
Note: The additional included encodings (serde_lite
, rkyv
, multipart form data) are all enabled by additive features on the server_fn
crate. If you want to use them you can just add that crate as a dependency and enable the required features.
Example: You can find a comprehensive example of these new features in the new server_fns_axum
example.
v0.5.6
v0.5.5
This is a (mostly) bug fix and documentation improvements release. If you're interested in the full list, check out the full What's Changed list below.
What's New
Trailing Slash Changes
@NfNitLoop discovered that by default the leptos_router strips trailing slashes from routes, which might not be what users expect. By default, leptos_router drops the trailing slash on /foo/
. He's added a new optional setting on Router that could allow you to keep the slashes and have routes for both /foo
and /foo/
or redirect from /foo/
to /foo
. Check out the docs for details: https://docs.rs/leptos_router/0.5.5/leptos_router/enum.TrailingSlash.html
Thanks @NfNitLoop!
Thanks to all our new and existing contributors, the 0.6 alpha will be coming out soon with fancy new server functions, so don't go away!
What's Changed
- Fix book chapter 3.9 #3 by @jollygreenlaser in #2053
- docs: minor fixes for some code examples in the book by @rockie in #2077
- docs: correct titile level for 04b_iteration.md by @sdutwsl in #2080
- Chore: Bump http from 0.2.8 to 0.2.11. by @martinfrances107 in #2068
- Use new with macro in book pages, update formatting for create effect page by @jollygreenlaser in #2054
- Improve macro hygiene by @blorbb in #2084
- Book updates by @diversable in #2052
- docs: point the book toward its new location with redirects by @gbj in #2095
- Fix WASI builds trying to use JS for
spawn_local
by @itowlson in #2066 - fix: add support for placing attributes on server functions by @tlowerison in #2093
- fix: support complete URLs in
<A/>
and<Form/>
(closes #2076) by @gbj in #2096 - Minor documentation corrections by @niclas-ahden in #2098
- example session-auth-axum: Minor changes for ergonomics by @j0lol in #2057
- Make tailwind examples more clear by @jsimonrichard in #2102
- add nix-darwin support, update flake by @Gentle in #2106
- fix: let
mount_to_body
acceptFnOnce
closures (closes #2115) by @NKID00 in #2116 - chore: don't warn when stabilized features are used by @gbj in #2118
- Support additional context for route generation by @NiklasEi in #2113
- Added documentation for server fns by @rakshith-ravi in #2099
- chore: clean up warnings causing CI issues by @gbj in #2119
- Bumping itertool version number, fixes downstream "Clippy" warning issue. by @martinfrances107 in #2124
- 'a lifetime are not linking input params to the output. Should be replaced by static by @martinfrances107 in #2125
- fix:
<Transition/>
fallback should show on if client-rendered (closes #2123) by @gbj in #2128 - docs: specify form for component generics by @gbj in #2129
- fix: emit original token stream when there are syntax errors in
#[component]
or#[island]
function signature (closes #2133) by @gbj in #2134 - Fixes broken tailwind example repo link by @JackSpagnoli in #2138
- chore: clarify
cargo-make
and examples (see #2141) by @gbj in #2150 - Make IntoAttribute more flexible for Options by @SleeplessOne1917 in #2130
- chore: remove newly-detected unused tuple fields by @gbj in #2169
- Namespace caches and branches with new router IDs by @sbihel in #2135
- Cleanup some dead code in actix tailwind example by @paul-hansen in #2160
- fix: add rust-toolchain.toml to examples (fixes #2151) by @webmstk in #2161
- router: Fix router forgetting about state (fixes #2164) by @luxalpa in #2165
- chore(deps): bump tj-actions/changed-files from 39 to 41 in /.github/workflows by @dependabot in #2180
- Better handling for trailing slashes. (#2154) by @NfNitLoop in #2172
- change: change all tracing levels to
trace
to reduce verbosity by @gbj in #2176 - draft for sso_auth_session example by @sjud in #2117
New Contributors
- @jollygreenlaser made their first contribution in #2053
- @rockie made their first contribution in #2077
- @sdutwsl made their first contribution in #2080
- @itowlson made their first contribution in #2066
- @tlowerison made their first contribution in #2093
- @niclas-ahden made their first contribution in #2098
- @jsimonrichard made their first contribution in #2102
- @NKID00 made their first contribution in #2116
- @NiklasEi made their first contribution in #2113
- @JackSpagnoli made their first contribution in #2138
- @sbihel made their first contribution in #2135
- @paul-hansen made their first contribution in #2160
- @luxalpa made their first contribution in #2165
- @dependabot made their first contribution in #2180
- @NfNitLoop made their first contribution in #2172
Full Changelog: v0.5.4...v0.5.5