cargo leptos 0.2.0-beta
`v0.2.0-beta`

latest releases: 0.7.0-preview2, 0.7.0-preview, 0.6.11...
16 months ago

v0.2.0-beta

This release is a preview, and also serves to generate new docs on docs.rs, as the current ones are getting slightly out of sync with our main branch here.

Changes from 0.2.0-alpha to 0.2.0-beta

  • Resource::read() and Resource::with() now take a Scope as their first argument, i.e., resource.read() is now resource.read(cx). This is necessary for correct <Suspense/> behavior.
  • The Errors type has been modified to hide its internals and expose IntoIter directly. In 99% of cases this just means replacing references like errors.get().0.into_iter() with errors.get().into_iter()
  • Most of the methods on various signal types have been moved into traits instead. This should not cause any actual changes to the way you use them, and if you are accustomed to use leptos::* you probably won't notice the difference; if you are manually importing types you will need to import the signal traits as well.

Included below are the notes for 0.2.0-alpha, so you can see changes since 0.1.3 as well.

Breaking Changes since 0.1.3

  • The <For/> component view argument now takes a Scope as its first argument, i.e., a change from view=move |counter| { ... } to view=move |cx, counter| { ... }
  • The <ErrorBoundary/> component fallback argument now takes a Fn(Scope, RwSignal<Errors>) -> impl IntoView instead of Fn(Scope, Option<RwSignal<Errors>>) -> impl IntoView
  • NodeRef now takes NodeRef<T> instead of NodeRef<HtmlElement<T>>. We're also deprecating NodeRef::new(cx) in favor of create_node_ref(cx) to follow the same pattern as everything else in the framework.
  • We've finally achieved full consistency between cargo-leptos and the server integrations whether you're using cargo-leptos or not. The site_address field is now named site_addr; the compiler should actually prompt you correctly for this one.
  • The current Leptos global namespace is polluted with a huge number of types and reexports, making it harder to find things in docs and adding compile-time overhead. If you're used to use leptos::* you may need to manually import a few additional types. We're also no longer reexporting wasm-bindgen, web-sys, and js-sys so you may need to add them as dependencies to your Cargo.toml
  • APIs to modify status code and headers in HTTP responses are now synchronous, making them easier to set in components

Other Improvements

  • New <Html/> and <Body/> components in leptos_meta that let you change things like <html> lang and dir, and add a class to the <body>
  • Restoring on: event listeners on <Component/> nodes, e.g., <MyFancyButton on:click=.../> without needing to create an on_click prop
  • Adding a <Redirect/> component in the router that works during client-side navigation or server-side rendering
  • Children, AttributeValue, and other type aliases to make it easier to accept a variety of types in your components
  • Experimentation with new docs using CodeSandboxes and an expanding set of tutorials
  • So, so, so, so many bugfixes, typos, docs improvements, and small changes by many, many, many members of the community. Thanks to you all!

What's Changed

  • leptos_dom erros.rs remove() does not need to be generic. by @martinfrances107 in #516
  • fix: correct namespace for Unit in empty views (closes #518) by @gbj in #520
  • Reexport web-sys event types to make it easier to type handlers by @gbj in #521
  • Identify CSS to reload from the href by @akesson in #524
  • change: tweak API of Errors and implement IntoIter by @gbj in #522
  • fix: top-level SVG in view macro with new exports by @gbj in #525
  • feature: reintroduce limited template-node cloning w/ template macro by @gbj in #526
  • fix: hydration IDs for elements following <Suspense/> (closes #527) by @gbj in #531
  • feature: in-order streaming and async rendering by @gbj in #496
  • fix compile of leptos dom by @seanaye in #535
  • Signal traits by @jquesada2016 in #490
  • v0.2.0-alpha2 by @gbj in #539
  • fix: building leptos_reactive in release mode by @gbj in #540
  • 533 by @jquesada2016 in #538
  • fix(examples): hackernews_axum styles href by @ApplY3D in #536
  • revert PR #538 by @gbj in #544
  • fix: more work on hydration IDs with <Suspense/> by @gbj in #545
  • change: pass Scope into Resource::read() and Resource::with() by @gbj in #542
  • document typo by @chrislearn in #553
  • Fix typo in hydration.rs by @eltociear in #552
  • Fix issue with redirects in server fns creating multiple Location headers by @benwis in #550

New Contributors

Full Changelog: v0.2.0-alpha...v0.2.0-beta

Don't miss a new leptos release

NewReleases is sending notifications on new releases.