cargo leptos 0.7.0-preview2
v0.7.0-preview2

latest releases: 0.7.0-rc1, 0.7.0-rc0
6 months ago

The -preview here is intended to convey: Here is a mostly-working but pre-alpha release of what I've been working on for the last six months or so. This work can be found in the leptos-0.7 branch. Enough work has been done that many (but not all) of the examples in the repo are functioning. This release is a fairly complete rewrite of the internals of the entire framework. You should expect both missing APIs and bugs.

Note the following:

  • You probably cannot just drop 0.7.0-preview2 to the Cargo.toml of an existing app and expect it to work
  • Imports have moved around a bit, to help improve discoverability, including moving from use leptos::*; to use leptos::prelude::*; and then using modules and reexports more sanely from the main crate
  • I've created a 0.7.0-preview playground that includes the setup of a basic app with comments. You should be able to expand from there.
  • There are lots of missing docs. These are easier to fill in going forward than to keep up to date during really active development.

Examples that Work

The following examples in the repo are known to work and can be useful to learn from

Notable Changes

  • I'm trying to avoid using features to change behavior as much as possible; see examples for Cargo.toml setup
  • use leptos::prelude::* instead of use leptos::*
  • Reactive system is now Send/Sync. In general for values being stored in signals this means you need to use Arc on occasion instead of Rc, etc.
    • For browser-only types stored inside signals I've tended to use the send_wrapper crate. Better ergonomics here are an open question
  • There are Arc equivalents to each signal type (ArcRwSignal, ArcMemo, etc.) which manage their lifecycle via reference counting rather than the reactive ownership graph. This can be used for things like iterating over nested signals (see counters example) and pushing signals "up" in the tree, rather than using the manual .dispose() and owner manipulation patterns
  • Continuing to move names toward more typical Rust naming patterns (RwSignal::new(), signal() instead of create_signal() to match channel(), etc.)
  • Suspense now uses actual async -- see examples
  • The router uses a more statically-typed/compile-time route segment matching pattern. I have plans for a path!() macro to parse the old strings into this format but it's not implemented.
  • Route matching is now "first match wins," rather than using a scoring algorithm. I think this should work similarly to server-side route matching, but is not exactly how the old system worked.

Known Missing APIs

  • cargo-leptos hot reloading
  • Actix integration (the playground uses Axum)
  • on: on components
  • spreading attributes onto components
  • anything animated (AnimatedShow, AnimatedRoutes, AnimatedOutlet)
  • Portals
  • slots
  • islands?
  • ... will add more here

Steps before -alpha

  • Migrate remaining examples
  • Missing features (above)
  • Update docs
  • Update tests

What's Helpful?

Try things out, see what breaks, see what feels good. How can we improve the module imports? What are pain points? etc. Feel free to comment here or on Discord in the #preview channel,

Don't miss a new leptos release

NewReleases is sending notifications on new releases.