github leptos-rs/leptos v0.6.0-beta

latest releases: v0.6.15, v0.6.14, v0.7.0-beta...
pre-release8 months ago

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 your main.rs, as server functions are now handled in .leptos_routes()
  • The current extract function has been removed, and replaced with a new extract that has the same API as the current extractor. 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 your main.rs, as server functions are now handled in .leptos_routes()
  • The current extract function has been removed, and replaced with a new extract that has the same API as the current extractor. I think this API is strictly better, but please share feedback if you disagree.

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/or FromRes 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.

Don't miss a new leptos release

NewReleases is sending notifications on new releases.