github leptos-rs/leptos v0.5.0-alpha

latest releases: v0.7.0-rc2, v0.7.0-rc1, v0.7.0-rc0...
pre-release16 months ago

This long-awaited release significantly changes how the reactive system works. This should solve several correctness issues/rough edges that related to the manual use of cx/Scope and could create memory leaks. (See #918 for details)

It also has the fairly large DX change (improvement?) of removing the need to pass cx or Scope variables around at all.

Migration is fairly easy. 95% of apps will migrate completely by making the following string replacements:

  1. cx: Scope, => (empty string)
  2. cx: Scope => (empty string)
  3. cx, => (empty string)
  4. (cx) => ()
  5. |cx| => ||
  6. Scope, => (empty string)
  7. Scope => (empty string) as needed
  8. You may have some |_, _| that become |_| or |_| that become ||, particularly for the fallback props on <Show/> and <ErrorBoundary/>

Basically, there is no longer a Scope type, and anything that used to take it can simply be deleted.

For the 5%: if you were doing tricky things like storing a Scope somewhere in a struct or variable and then reusing it, you should be able to achieve the same result by storing Owner::current() somewhere and then later using it in with_owner(owner, move || { /* ... */ }).

There are no other big conceptual or API changes in this update: essentially all the same reactive, templating, and component concepts should still apply, just without cx.

Expected to Not Work

leptosfmt and cargo leptos --hot-reload, which assume that the view! needs a cx,, will probably not work as intended and will need to be updated.

Any other ecosystem libraries that depend on Leptos 0.4 won't work, of course.

Help Wanted

This needs pretty extensive testing with real apps. It passes our test suite and the examples seem to work fine, but I'm sure there are bugs out there. Help find them! I've created a discussion linked to these release notes that you can use for feedback or to help track down bugs.

Don't miss a new leptos release

NewReleases is sending notifications on new releases.