Releases: leptos-rs/leptos
`v0.2.4`
v0.2.3
fixed support for stable Rust, which I temporarily broke in v0.2.2
.
The main change in v0.2.4
is a rewritten reactive system. This didn't involve any breaking API changes, except to the extent that fixing bugs and glitchy behavior breaks apps that depend on the glitches. It pretty significantly improves the performance of the reactive system on deep graphs (i.e., when you have a chain of dependencies like memos leading from a signal to an effect), as well as fixing reactive "glitching" behaviors in ways that make effects run more efficiently. You can read more about the details here.
Other changes:
- improved error handling in
<ActionForm/>
- Support for using signals directly in the view in stable Rust
- cancelable versions of
set_timeout
,request_idle_callback
, andrequest_animation_frame
(all ending withwith_handle
) - a
debounce
helper that makes it easy to debounce event listeners - allow manual disposal of signals before the current reactive cope is disposed with the
SignalDispose
trait (and.dispose()
) function, to avoid leaking memory if you create a list of signals at the root scope - allow batching multiple updates with
Scope::batch()
before running effects - many small bugfixes
What's Changed
- fix broken stable support by @gbj in #670
- feat:
<ActionForm/>
improvements by @gbj in #676 - chore: apply
cargo machete
systematically by @gbj in #671 - feat: new reactive system implementation by @gbj in #637
- Fixed building in release (
cfg(not(debug_assertions))
) by @Buzzec in #679 - feat: maintain order of sources and dependencies by @gbj in #678
- CI: add
--release
checks by @gbj in #681 - fix: leaking stored values by @gbj in #683
- fix: suppress spurious hydration warnings for tags in
leptos_meta
by @gbj in #684 - Added
IntoView
forReadSignal
andRwSignal
in thestable
feature. by @Buzzec in #677 - docs: typos by @ryndin32 in #685
- fix: allow multiple
<Suspense/>
on same page during in-order or async rendering by @gbj in #687 - Added example using Tailwind, CSR (only) and Trunk by @vascokk in #666
- fix: hydration errors with
<Suspense/>
inside components in SSR mode by @gbj in #688 - feat: support diffing inside component children in hot-reload by @gbj in #690
- examples: remove duplicate
console_error_panic_hook::set_once()
calls by @elliotwaite in #692 - docs: beginning work on router docs by @gbj in #682
- fix issues in release mode (closes #700) by @gbj in #701
- fix: ignore view markers in DynChild hydration (closes issue #697) by @gbj in #703
- feat: add cancellable versions of
request_animation_frame
andrequest_idle_callback
by @elliotwaite in #698 - feat: add a
debounce
helper for event listeners by @gbj in #691 view!
macro not compiling with a non-default scope name by @alexisfontaine in #704- Clippy: less .clone() calls, simpler pointer passing. by @martinfrances107 in #707
- feat: add
set_interval_with_handle
and deprecateset_interval
by @gbj in #709 - feat: allow manual signal disposal before the scope is disposed by @gbj in #710
- feat: add
Scope::batch()
by @gbj in #711 - chores: clearing up some warnings and adding missing exports by @gbj in #712
- Used modulo rather than bitwise & for is_odd check. by @carltongibson in #713
- docs: small fixes by @gbj in #715
- fix:
<Transition/>
behavior by @gbj in #717 - Minor: Simplifiy Box::Pin() call. by @martinfrances107 in #718
New Contributors
- @Buzzec made their first contribution in #679
- @ryndin32 made their first contribution in #685
- @vascokk made their first contribution in #666
- @alexisfontaine made their first contribution in #704
- @carltongibson made their first contribution in #713
Full Changelog: v0.2.2...v0.2.4
`v0.2.2`
I forgot to make a tag or publish release notes for 0.2.1
. These are both patch releases that include some performance improvements, a number of bugfixes, and spinning out a framework-independent server function crate, but don't include any particularly big new features.
Small new features
rkyv
encoding as an option for resources- allowing multiple class names in
class =
syntax inview!
macro - provide a new
LeptosRequest<_>
type that allows Leptos Axum apps access to the request viause_context
, which allows you to use Axum extractors without a special handler - preliminary hot-reloading support, to be built into
cargo-leptos
, for updating static parts of the view before recompiling the Rust parts of your app
What's Changed
- Some cleanups in router/matching/resolve_paths by @g-re-g in #569
- perf: improvements to element creation in
<For/>
by @gbj in #579 - feat: Support
rkyv
encoding by @617a7a in #577 - make counter test compile by @eiswind in #588
- fix:
mouseenter
andmouseleave
do not bubble by @gbj in #593 - Update example readme by @brendonotto in #595
- examples: include missing examples in CI by @gbj in #598
- fix: SSR + hydration improvements by @gbj in #599
- cx typo in 02_getting_started.md by @iagafonov in #602
- Fix typo in 03_components.md by @makoven in #603
- In
Action::dispatch()
set new value before resetting input signal by @Qwox0 in #604 - fix: memory leak in
render_to_stream
by @gbj in #601 - Make server functions framework agnostic by @Demonthos in #596
- use create_node_ref instead of NodeRef::new by @iagafonov in #607
- publish framework-independent
server_fn
crate by @gbj in #605 - fix compilation error, Issue #608 by @kulak in #609
- updated error handling code in book by @iagafonov in #610
- feat: support expr for #[prop(default=...)] by @ModProg in #611
- Minor: Clippy - Simplified conditional logic in transition.rs. by @martinfrances107 in #615
- docs: improve "Getting Started" page by @gbj in #618
- feat: allow multiple class names in
view!
macroclass =
(closes #612) by @gbj in #614 - tests: use
check
instead ofbuild
in CI for disk space by @gbj in #616 - docs: add patterns for global state (closes #245) by @gbj in #619
- feat: allow easier client-side form validation (closes #413) by @gbj in #620
- fix: suppress warnings caused by resource loading in
generate_route_list
(closes #582) by @gbj in #621 - CI: exclude
rkyv
combos with other serialization traits by @gbj in #622 - docs: add a chapter on
async
actions andcreate_action
by @gbj in #623 - [WIP] feat: hot reloading support for
cargo-leptos
by @gbj in #592 - fix: added missing attributes of events that don't bubble by @WafflePersonThing in #625
- fix: boolean attributes in SSR by @gbj in #629
- docs: fix instruction typos by @Banyc in #631
- docs: Update 04_iteration.md by @jfloresremar in #630
- bump typed-builder to version 0.13. by @martinfrances107 in #633
- de-duplicate todomvc example by @erwanvivien in #634
- CI: split into three actions by @gbj in #636
- New example: session_auth_axum by @j0lol in #589
- fix: custom events (closes issue #641) by @gbj in #642
- Bump tower-http upto 0.4. by @martinfrances107 in #638
- Minor: form component Removed unused variables. by @martinfrances107 in #640
- Bump serde-wasm-bindgen to 0.5. by @martinfrances107 in #639
- Cargo machete: Strip down leptos_server. by @martinfrances107 in #644
- Unit tests for
leptos-config
and new functions for loading configuration by @vaniusrb in #628 - chore: typo (closes issue #645) by @gbj in #646
- bump bytecheck to 0.7, remove deprecated simdutf8_std. by @martinfrances107 in #647
- Bumped typed-builder up to 0.14. by @martinfrances107 in #648
- fix spelling error for document by @zackshen in #651
- docs: add
create_effect
chapter by @gbj in #653 - Make server functions work outside of WASM by @Demonthos in #643
- π§ Fix(leptos_dom/logging): Fix showing warning instead of error by @pikhosh in #654
- feat: impl
IntoView
for&Fragment
by @gbj in #655 - cargo machete: leptos_macro - Removed unused crates. by @martinfrances107 in #656
- Put the Request on the Context for Axum by @benwis in #632
- feat: add fragment support for hot reloading and fix some stuff by @gbj in #659
- Copy & Clone for MaybeSignal by @CharlesTaylor7 in #660
- fix: text node issue in
template
macro by @gbj in #661 - fix: apply patches to all instances of a view, not just the first one by @gbj in #663
- Typo fixes and other small changes to the docs by @elliotwaite in #662
- Clippy: signal_wrappers_read, was using .clone() when copy is available. by @martinfrances107 in #665
v0.2.2
by @gbj in #667
New Contributors
- @617a7a made their first contribution in #577
- @eiswind made their first contribution in #588
- @brendonotto made their first contribution in #595
- @iagafonov made their first contribution in #602
- @makoven made their first contribution in #603
- @Qwox0 made their first contribution in #604
- @Demonthos made their first contribution in #596
- @kulak made their first contribution in #609
- @WafflePersonThing made their first contribution in #625
- @Banyc made their first contribution in #631
- @jfloresremar made their first contribution in #630
- @erwanvivien made their first contribution in #634
- @j0lol made their first contribution in #589
- @vaniusrb made their first contribution in #628
- @zackshen made their first contribution in #651
- @pikhosh made their first contribution in #654
- @CharlesTaylor7 made their first contribution in #660
- @elliotwaite made their first contribution in #662
Full Changelog: v0.2.0...v0.2.2
`v0.2.0`
v0.2.0
v0.2.0
is an incremental change over 0.1.x
. There are a few small things that have been breaking changes over the last two months, one big new feature, and a lot of small improvements and changes.
Async Rendering and In-Order Streaming
The biggest new feature of 0.2.0
that requires explanation is support for async
rendering and in-order streaming, which you can activate via the new ssr
prop on a <Route/>
. (See the ssr_modes
and ssr_modes_axum
examples.)
With this new feature, Leptos now supports four different ways to render HTML that contains async
data loaded under <Suspense/>
. You can opt in to one or the other on a per-route basis.
- Synchronous: Serve an HTML shell that includes
fallback
for anySuspense
. Load data on the client, replacingfallback
once they're loaded.- Pros: App shell appears very quickly: great TTFB (time to first byte).
- Cons: Resources load relatively slowly; you need to wait for JS + WASM to load before even making a request.
- Out-of-order streaming: Serve an HTML shell that includes
fallback
for anySuspense
. Load data on the server, streaming it down to the client as it resolves, and streaming down HTML forSuspense
nodes.- Pros: Combines the best of synchronous and
async
, with a very fast shell and resources that begin loading on the server. - Cons: Requires JS for suspended fragments to appear in correct order. Weaker meta tag support when it depends on data that's under suspense (has already streamed down
<head>
)
- Pros: Combines the best of synchronous and
- In-order streaming: Walk through the tree, returning HTML synchronously as in synchronous rendering and out-of-order streaming until you hit a
Suspense
. At that point, wait for all its data to load, then render it, then the rest of the tree.- Pros: Does not require JS for HTML to appear in correct order.
- Cons: Loads the shell more slowly than out-of-order streaming or synchronous rendering because it needs to pause at every
Suspense
. Cannot begin hydration until the entire page has loaded, so earlier pieces
of the page will not be interactive until the suspended chunks have loaded.
async
: Load all resources on the server. Wait until all data are loaded, and render HTML in one sweep.- Pros: Better handling for meta tags (because you know async data even before you render the
<head>
). Faster complete load than synchronous because async resources begin loading on server. - Cons: Slower load time/TTFB: you need to wait for all async resources to load before displaying anything on the client.
- Pros: Better handling for meta tags (because you know async data even before you render the
The mode defaults to out-of-order streaming. For a path that includes multiple nested routes, the most
restrictive mode will be used: i.e., if even a single nested route asks for async
rendering, the whole initial
request will be rendered async
. (async
is the most restrictive requirement, followed by in-order, out-of-order, and synchronous.)
Because you have the ability to opt into these different modes on a per-route basis, you can choose the rendering strategy that is best for youβnot only for your app in general, but for any given page.
Other Features and Improvements
- New
<Html/>
and<Body/>
components inleptos_meta
that let you change things like<html>
lang
anddir
, and add aclass
to the<body>
- Restoring
on:
event listeners on<Component/>
nodes, e.g.,<MyFancyButton on:click=.../>
without needing to create anon_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!
Breaking Changes Since 0.1.3
Resource::read()
andResource::with()
now take aScope
as their first argument, i.e.,resource.read()
is nowresource.read(cx)
. This is necessary for correct<Suspense/>
behavior.- The
Errors
type has been modified to hide its internals and exposeIntoIter
directly. In 99% of cases this just means replacing references likeerrors.get().0.into_iter()
witherrors.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. - The
<For/>
componentview
argument now takes aScope
as its first argument, i.e., a change fromview=move |counter| { ... }
toview=move |cx, counter| { ... }
- The
<ErrorBoundary/>
componentfallback
argument now takes aFn(Scope, RwSignal<Errors>) -> impl IntoView
instead ofFn(Scope, Option<RwSignal<Errors>>) -> impl IntoView
NodeRef
now takesNodeRef<T>
instead ofNodeRef<HtmlElement<T>>
. We're also deprecatingNodeRef::new(cx)
in favor ofcreate_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 usingcargo-leptos
or not. Thesite_address
field is now namedsite_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 reexportingwasm-bindgen
,web-sys
, andjs-sys
so you may need to add them as dependencies to yourCargo.toml
- APIs to modify status code and headers in HTTP responses are now synchronous, making them easier to set in components
Complete CHANGELOG
- Add
Children
type alias by @gbj in #403 - Fix boolean attributes in
view
macro fast-path SSR by @gbj in #408 - Add
<Html/>
and<Body/>
components inleptos_meta
by @gbj in #407 - Minor: Bump typed-builder from 0.11 to 0.12. by @martinfrances107 in #409
- Escape and tokens in documentation markup. by @martinfrances107 in #410
- fix: correct types for top-level
<option>
and<use>
in SSRview
macro by @gbj in #416 - Switch RwLock to parking_lot so they are no longer async by @benwis in #414
- Add leptos_routes functions for integrations by @b4-io in #415
- Fix issues with attribute names in SSR by @gbj in #418
- Implemented update_returning for StoredValue by @thestarmaker in #419
- Update ErrorBoundary to use miette::Diagnostic instead of Error, and various other tweaks by @benwis in #401
- Fix some small issues in
axum_errors
example by @gbj in #424 - fix: Make all fragment rendering lazy (closes #299 and #421) by @gbj in #425
- fixes cx not found on components marked with #[component(transparent)] by @jquesada2016 in #423
- Several Minor Updates on Examples by @Indrazar in #427
- Make
RouteDefinition
public by @gbj in #430 - docs: Document
inner_html
attribute by @gbj in #429 - chore: switch examples to
check
instead ofbuild
(for CI) & add missing examples by @gbj in #437 - Fix top-level SVG elements in SSR by @gbj in #435
- fix: correct behavior of
<Show/>
by @gbj in #436 - Dedup from_str implementations for Env by @g-re-g in #426
- leptos-server: Removed unused dependency on log, linear-map and rmp-serde. by @martinfrances107 in #439
- leptos_macro: Machete - Removed unused deps. by @martinfrances107 in #441
- router: Machete - Removed unused deps. by @martinfrances107 in #442
- use latest tokio in leptos_axum by @Gentle in #443
- fix: successfully pass context to nested routes via
<Outlet/>
by @gbj in #447 - feature: allow
on:
event listeners on<Component/>
nodes by @gbj in #448 - fix: update leptos dependencies paths to the workspace by @turbotobias in #449
- fix:
leptos_router
hydration issues by @gbj in #450 - Clippy: "{input} is not a supported environment." by @martinfrances107 in #451
- fix: stack overflow in with nested outlet (closes #452) by @gbj in #453
- fix: typo in
leptos_config
description by @odiseo0 in #455 - docs: add new
Children
types to macro docs by @gbj in https://g...
`v0.2.0-beta`
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()
andResource::with()
now take aScope
as their first argument, i.e.,resource.read()
is nowresource.read(cx)
. This is necessary for correct<Suspense/>
behavior.- The
Errors
type has been modified to hide its internals and exposeIntoIter
directly. In 99% of cases this just means replacing references likeerrors.get().0.into_iter()
witherrors.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/>
componentview
argument now takes aScope
as its first argument, i.e., a change fromview=move |counter| { ... }
toview=move |cx, counter| { ... }
- The
<ErrorBoundary/>
componentfallback
argument now takes aFn(Scope, RwSignal<Errors>) -> impl IntoView
instead ofFn(Scope, Option<RwSignal<Errors>>) -> impl IntoView
NodeRef
now takesNodeRef<T>
instead ofNodeRef<HtmlElement<T>>
. We're also deprecatingNodeRef::new(cx)
in favor ofcreate_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 usingcargo-leptos
or not. Thesite_address
field is now namedsite_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 reexportingwasm-bindgen
,web-sys
, andjs-sys
so you may need to add them as dependencies to yourCargo.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 inleptos_meta
that let you change things like<html>
lang
anddir
, and add aclass
to the<body>
- Restoring
on:
event listeners on<Component/>
nodes, e.g.,<MyFancyButton on:click=.../>
without needing to create anon_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 implementIntoIter
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
intoResource::read()
andResource::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
- @seanaye made their first contribution in #535
- @ApplY3D made their first contribution in #536
- @chrislearn made their first contribution in #553
- @eltociear made their first contribution in #552
Full Changelog: v0.2.0-alpha...v0.2.0-beta
`v0.2.0-alpha`
v0.2.0-alpha
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.
I do not expect significant difficulties in migrating from 0.1.3
to 0.2.0
. There are a few API tweaks here that necessitate a version bump but it's an order of magnitude smaller than the change from 0.0.x
to 0.1.0
and will not touch most parts of your application.
Breaking Changes
- The
<For/>
componentview
argument now takes aScope
as its first argument, i.e., a change fromview=move |counter| { ... }
toview=move |cx, counter| { ... }
- The
<ErrorBoundary/>
componentfallback
argument now takes aFn(Scope, RwSignal<Errors>) -> impl IntoView
instead ofFn(Scope, Option<RwSignal<Errors>>) -> impl IntoView
NodeRef
now takesNodeRef<T>
instead ofNodeRef<HtmlElement<T>>
. We're also deprecatingNodeRef::new(cx)
in favor ofcreate_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 usingcargo-leptos
or not. Thesite_address
field is now namedsite_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 reexportingwasm-bindgen
,web-sys
, andjs-sys
so you may need to add them as dependencies to yourCargo.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 inleptos_meta
that let you change things like<html>
lang
anddir
, and add aclass
to the<body>
- Restoring
on:
event listeners on<Component/>
nodes, e.g.,<MyFancyButton on:click=.../>
without needing to create anon_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!
Complete Changelog
- Add
Children
type alias by @gbj in #403 - Fix boolean attributes in
view
macro fast-path SSR by @gbj in #408 - Add
<Html/>
and<Body/>
components inleptos_meta
by @gbj in #407 - Minor: Bump typed-builder from 0.11 to 0.12. by @martinfrances107 in #409
- Escape and tokens in documentation markup. by @martinfrances107 in #410
- fix: correct types for top-level
<option>
and<use>
in SSRview
macro by @gbj in #416 - Switch RwLock to parking_lot so they are no longer async by @benwis in #414
- Add leptos_routes functions for integrations by @b4-io in #415
- Fix issues with attribute names in SSR by @gbj in #418
- Implemented update_returning for StoredValue by @thestarmaker in #419
- Various tweaks to ErrorBoundary by @benwis in #401
- Fix some small issues in
axum_errors
example by @gbj in #424 - fix: Make all fragment rendering lazy (closes #299 and #421) by @gbj in #425
- fixes cx not found on components marked with #[component(transparent)] by @jquesada2016 in #423
- Several Minor Updates on Examples by @Indrazar in #427
- Make
RouteDefinition
public by @gbj in #430 - docs: Document
inner_html
attribute by @gbj in #429 - chore: switch examples to
check
instead ofbuild
(for CI) & add missing examples by @gbj in #437 - Fix top-level SVG elements in SSR by @gbj in #435
- fix: correct behavior of
<Show/>
by @gbj in #436 - Dedup from_str implementations for Env by @g-re-g in #426
- leptos-server: Removed unused dependency on log, linear-map and rmp-serde. by @martinfrances107 in #439
- leptos_macro: Machete - Removed unused deps. by @martinfrances107 in #441
- router: Machete - Removed unused deps. by @martinfrances107 in #442
- use latest tokio in leptos_axum by @Gentle in #443
- fix: successfully pass context to nested routes via
<Outlet/>
by @gbj in #447 - feature: allow
on:
event listeners on<Component/>
nodes by @gbj in #448 - fix: update leptos dependencies paths to the workspace by @turbotobias in #449
- fix:
leptos_router
hydration issues by @gbj in #450 - Clippy: "{input} is not a supported environment." by @martinfrances107 in #451
- fix: stack overflow in with nested outlet (closes #452) by @gbj in #453
- fix: typo in
leptos_config
description by @odiseo0 in #455 - docs: add new
Children
types to macro docs by @gbj in #454 - Derive debug for params struct in server macro by @g-re-g in #458
- perf: further reduce WASM binary size by ~5-7% by @gbj in #459
- Fix #457 by @Threated in #460
- docs: add note about optional
fallback
in<Show/>
(closes #406) by @gbj in #463 - impl Default for MaybeSignal by @ModProg in #464
- feature: add isomorphic
<Redirect/>
component (closes #412) by @gbj in #466 - Add simple icon logo by @underscorefunk in #468
- error on non meta input for prop attribute by @ModProg in #469
- fix: don't override element event listeners with component event listeners by @gbj in #470
- fix: fix
node_ref
in SSR by @gbj in #471 - Convert site_address to site_addr by @benwis in #462
- impl From<&str> for MaybeSignal by @g-re-g in #472
- fix: correct out-of-order streaming behavior (closes #473) by @gbj in #475
- fix:
cargo doc
in projects using#[server]
by @gbj in #476 - fix: adding/removing errors from
<ErrorBoundary/>
by @gbj in #478 - Experiments in new tutorial/guide format with integrated CodeSandboxes by @gbj in #375
- remove unnecessary
"openssl"
feature from Actix examples by @gbj in #480 - Better styling for router related components by @Threated in #477
- fix: errors on 404 page in
axum_errors
example by @gbj in #485 - Minor: Clippy router now uses types OnFormData and OnResponse. by @martinfrances107 in #484
- fix: correct behavior for
inner_html
in SSR by @gbj in #487 - fix: typed route params with
#[derive(Params)]
by @gbj in #488 - Fix node ref generics by @jquesada2016 in #481
- fix: fix
debug_warn
behavior in reactive crate and removelog
dependency by @gbj in #491 - change: add
Scope
to view function in<For/>
to avoid memory "leak" by @gbj in #492 - fix: error boundary hydration by @gbj in #494
- Suspense: removed unused .clone() call. by @martinfrances107 in #486
- examples: remove unused
index.html
by @gbj in #497 - Allow literal string as class in view macro by @g-re-g in #500
- fix: proper disposal of nested route scopes by @gbj in #499
- workspace
rustfmt
by @jquesada2016 in #483 - apply new formatting everywhere by @gbj in #502
- Docs improvements by @gbj in #505
- fix:
<For/>
intodomvc
example by @gbj in #504 - docs: add docs on testing (clos...
`v0.1.3`
The big changes here are the <ErrorBoundary/>
and <Show/>
components. Many thanks to @benwis for leading the work on these.
You should also see a very significant improvement in SSR performance, as well as small reductions in Wasm binary sizes, and some overall bugfixes and improvements.
Oh, and... π΅πΆ We don't talk about 0.1.2
. πΆπ΅
What's Changed
- doc: add link for leptos watch by @imalexlab in #347
- Reenable optimizations for SSR using the
view!
macro by @gbj in #344 - Add SVG
<script>
,<style>
, and<title>
to set of ambiguous elements by @gbj in #350 - Add support for
class = ...
, inview
macro to support scoped styling by @gbj in #351 - Update html.rs by @gbj in #352
- ErrorBoundary Component by @benwis in #338
- Fix query params behaviour difference between SSR and Hydrate by @killertux in #343
- Allow snake case components by @jclmnop in #354
- Clippy fixes: redundant clone and .to_string() issues. by @martinfrances107 in #353
- leptos_reactive base64 bump version to 0.21. by @martinfrances107 in #358
- Add methods to take Actix/Axum Extractors/Route Info/Stuff and pass it to Leptos by @benwis in #359
- Reorganize snake-case
#[component]
docs and pleaseclippy
by @gbj in #362 - Add component to avoid rerendering of closures and tweak ErrorBoundary by @benwis in #363
- Replace urlencoding with percent-encoding by @flosse in #365
- Fix CSR with Trunk on hackernews example, remove CSR option from isomorphic example by @Indrazar in #369
- Make Errors Sync by @benwis in #372
- Add a counter example that does not use macros by @flosse in #373
- Fix context in outlets by @gbj in #374
- refactor to eliminate duplicate code by @Gentle in #380
- (micro optimization) cloning is not needed here by @Gentle in #381
- added
hgroup
element by @ModProg in #379 - leptos_axum::handle_server_fns was also duplicated by @Gentle in #383
- implements
From<Signal<T>>
forMaybeSignal<T>
by @gbj in #384 - Allow unused
cx
in server fn arguments by @gbj in #385 - Fix a large number of small issues in docs by @gbj in #386
- Check uniqueness of server function names at registration time by @gbj in #388
- Fix missing docs error by @gbj in #389
- fix: Align
<ActionForm/>
behavior withAction
by @gbj in #390 - doc/book updated leptos version. by @martinfrances107 in #392
- Remove
gloo
dependency inleptos_dom
by @gbj in #391 - Fix gtk example by @thomasqueirozb in #395
- Reduce WASM binary sizes by 3-5% by @gbj in #393
- Fix hydration issue related to WASM size reduction by @gbj in #396
v0.1.2
by @gbj in #397
New Contributors
- @imalexlab made their first contribution in #347
- @killertux made their first contribution in #343
- @jclmnop made their first contribution in #354
- @flosse made their first contribution in #365
- @ModProg made their first contribution in #379
- @thomasqueirozb made their first contribution in #395
Full Changelog: v0.1.1...v0.1.3
v0.1.1
0.1.1
is mostly a series of bugfixes to 0.1.0
; see the 0.1.0
release notes for a list of new features in this series. Thanks to our new contributors, and to everyone who's helped find bugs.
What's Changed
- Fix link to counters_stable in README by @dzfrias in #309
- Doc fix + search & replace url by @akesson in #310
- Update Generated API URL on Windows Attempt #2 by @Indrazar in #308
- Use rust-cache in CI by @TaKO8Ki in #312
- Fix doctest in
create_slice
and edit doc comment slightly by @gbj in #314 - Create CODE_OF_CONDUCT.md by @gbj in #315
- Death to suspense hydration mismatches by @gbj in #316
- Switch get_configuration calls to None and add a note in the docs for get_configuration() by @benwis in #318
- Fix
<Router fallback>
(signature and functionality) by @gbj in #324 - Use comments instead of element markers for hydration by @gbj in #321
- Make sure Axum returns a relative URI for http and https requests by @benwis in #326
- Updated example code and README to use latest syntax for data binding by @ekanna in #327
- Minor: For each sub crate the landing page should be the root README.md. by @martinfrances107 in #328
- impl
Debug
onMetaContext
by @gbj in #329 - typed-builder inconsistent version. by @martinfrances107 in #330
- Path and Query for Axum by @benwis in #331
- Add programmatic navigation in router example by @gbj in #332
- Fix
MetaContext
debug for wasm target by @gbj in #334 - Minimize panics when runtime has already been disposed (e.g., in SSR) by @gbj in #333
- Fix behavior of
RouteContext
in nested routes with different parameters by @gbj in #345 - Change
<Suspense/>
to a specialized type that uses comments for SSR by @gbj in #346
New Contributors
- @dzfrias made their first contribution in #309
- @TaKO8Ki made their first contribution in #312
- @ekanna made their first contribution in #327
Full Changelog: v0.1.0...v0.1.1
v0.1.0
Finally, here's the release for version 0.1.0
. Thanks to everyone who's been working with the alpha, beta, and bleeding-edge versions over the last few weeks to help get everything ready.
Most of the release notes below are copied from the 0.1.0-alpha
release, but include a few updates. All these changes are relative to 0.0.22
.
Features
More flexible rendering
You can now easily mix and match different types of node in a Fragment
, which previously needed to be a Vec
of all the same types (like a Vec<Fragment>
).
view! { cx,
<>
"This is some text."
<p>"Here's an element."</p>
<ComponentA/>
</>
}
In fact, the <>
fragment itself is optional.
view! { cx,
"This is some text."
<p>"Here's an element."</p>
<ComponentA/>
}
Typed HTML elements
HTML elements generated by the view!
macro are now typed, and implement Deref
to give a correctly-typed web_sys
element.
// returns `HtmlElement<Input>`
// derefs to a `web_sys::HtmlInputElement`
view! { cx, <input type="text"/> }
store_value
You can now store non-reactive values in the reactive system to take advantage of the same Copy + 'static
reference system without the overhead or abstraction leak of storing something in a signal. This is useful for objects you need to reference in multiple places throughout your application without cloning.
// this structure is neither `Copy` nor `Clone`
pub struct MyUncloneableData {
pub value: String
}
// β
you can move the `StoredValue` into closures and access it with .with()
let data = store_value(cx, MyUncloneableData { value: "a".into() });
let callback_a = move || data.with(|data| data.value == "a");
let callback_b = move || data.with(|data| data.value == "b");
Signal<T>
and SignalSetter<T>
abstractions
These wrappers allow you to define APIs that can take any kind of signal. For example, Signal<T>
can be a ReadSignal
, RwSignal
, Memo
, or derived signal. This is especially useful when defining components interfaces. (There's even a MaybeSignal
for types that may just be T
or may be a Signal<T>
.)
let (count, set_count) = create_signal(cx, 2);
let double_count = Signal::derive(cx, move || count() * 2);
let memoized_double_count = create_memo(cx, move |_| count() * 2);
// this function takes any kind of wrapped signal
fn above_3(arg: &Signal<i32>) -> bool {
// β
calling the signal clones and returns the value
// it is a shorthand for arg.get()
arg() > 3
}
assert_eq!(above_3(&count.into()), false);
assert_eq!(above_3(&double_count), true);
assert_eq!(above_3(&memoized_double_count.into()), true);
Massively improved Rust Analyzer support
DX with this new system is much better. You'll see hugely improved language-server integration for the view!
macro, including features like doc comments for HTML elements, autocompletion for component properties, clicking to go to the definition of a component, type hints for component arguments, etc.
Inline documentation in the #[component]
macro
You can now document components and their properties directly in the #[component]
macro like this:
/// A simple counter component.
///
/// You can use doc comments like this to document your component.
#[component]
pub fn SimpleCounter(
cx: Scope,
/// The starting value for the counter
#[prop(optional)]
initial_value: i32,
/// The change that should be applied each time the button is clicked.
step: i32
) -> impl IntoView {
// ...
}
The macro will automatically generate docs for the components and for each of its props.
#[prop]
attributes for component props
You can use the #[prop]
attribute macro to mark component props in several ways:
#[prop(into)]
: This will call.into()
on any value passed into the component prop. (For example,
you could apply#[prop(into)]
to a prop that takes Signal, which would
allow users to pass a ReadSignal or RwSignal
and automatically convert it.)#[prop(optional)]
: If the user does not specify this property when they use the component,
it will be set to its default value. If the property type isOption<T>
, values should be passed
asname=T
and will be received asSome(T)
.#[prop(optional_no_strip)]
: The same asoptional
, but requires values to be passed asNone
or
Some(T)
explicitly. This means that the optional property can be omitted (and beNone
), or explicitly
specified as eitherNone
orSome(T)
.#[prop(default = X)]
: The property is optional, and will be set to the default value provided if it is not passed.
tracing
support
We've added support for debugging using the tracing
crate, integrated into both the renderer and the reactive system. This means that when an effect or an event listener fires, you can use trace!(...)
to get an insight into the flow of your program. See leptos_dom/examples/test-bench
for an example setup; a separate crate to make this tracing setup easier will be forthcoming.
cargo-leptos
integration improvements
cargo-leptos 0.1.2
and the Actix/Axum integrations in 0.1.0
now work together seamlessly, allowing you to create full-stack applications with as little boilerplate as possible.
And much more!
- Comments that mark component boundaries for easier debugging, when in debug mode
- Removing the need to wrap things that
<Router/>
in a<div>
for no obvious reason - builder API that allows you to crate a UI without using the
view
macro - and all sorts of things I'm forgetting!
Breaking Changes
Here are a few things to watch out for as you migrate:
- If you're using
cargo-leptos
already and run into any issues (for example, with the path of a JS or Wasm file), be sure to check out the latest examples and the starter. The extra structures here have changed a bit over time as we've tried to figure out the best patterns. Cloning the starter and adding your existing application code should work fine. - All component functions should now return
-> impl IntoView
- The
<For/>
component now takes aview
property, instead of you passing the view function as the child of the component - Likewise, the
<Route/>
component takes aview
property instead ofelement
for consistency children
properties are now typedBox<dyn Fn(Scope) -> Fragment>
- The
view!
macro returns distinct structures, which are all different types. In other words, this code no longer compiles
// this won't work
if some_condition {
view! { cx, <p>"P if true"</p> }
} else {
view! { cx, <span>"SPAN if false"</span> }
}
because the first branch now returns HtmlElement<P>
while the second returns HtmlElement<Span>
.
In this case, simply add .into_any()
to each to return HtmlElement<AnyElement>
from both. In general, you can always call .into_view(cx)
to return a wrapping View
type instead.
// this works
if some_condition {
view! { cx, <p>"P if true"</p> }.into_any()
} else if something_else {
view! { cx, <span>"SPAN if false"</span> }.into_any()
}
v0.1.0-beta
v0.1.0-beta
This release mostly (see crates.io) consists mainly of polishing the many changes described in the 0.1.0-alpha
release notes.
Other significant improvements include:
- New
store_value()
andStoredValue
APIs that allow you to use the reactive system to storeCopy
and'static
handles to non-reactive values, just as you can with reactive signals. - Finally, complete integration with the
cargo-leptos
build tool, including transitioning most of the examples over to usecargo-leptos
(except for the client-only examples, which use Trunk) (kudos and many thanks to @benwis and @akesson) - Restoring
stable
support for the new version (thanks to @jquesada2016)
... in addition to many small bug-fixes.
We're making very good progress toward a final 0.1.0
release. The only outstanding changes at this point involve improving and updating documentation, slightly loosening a couple APIs to make them easier to use (for example, allowing the path
property on <Route/>
to take T: impl std::fmt::Display
rather than &'static str
), and a few performance improvements (like optimized SSR) that will have absolutely no effect on the API exposed to users, but continue to ensure high performance and a good experience.
v0.1.0-alpha
A preview of v0.1.0
π Merry Christmas!
I thought I'd offer this alpha release of the upcoming 0.1.0
so you can get a taste for some of what we've been working on. Shout out to @jquesada2016 for driving the work on the rewritten renderer that got us here, as well as huge improvements to the #[component]
macro and many other details of the framework.
You can track the current state of this work in PR #119. You can download the alpha from crates.io.
There are a few known issues still (see below) but this release should be more or less usable, and the APIs are pretty much final. You can expect something closer to a final release in the next few weeks, but here's what to look forward to in the meantime.
Features
More flexible rendering
You can now easily mix and match different types of node in a Fragment
, which previously needed to be a Vec
of all the same types (like a Vec<Fragment>
).
view! { cx,
<>
"This is some text."
<p>"Here's an element."</p>
<ComponentA/>
</>
}
Typed HTML elements
HTML elements generated by the view!
macro are now typed, and implement Deref
to give a correctly-typed web_sys
element.
// returns `HtmlElement<Input>`
// derefs to a `web_sys::HtmlInputElement`
view! { cx, <input type="text"/> }
Massively improved Rust Analyzer support
DX with this new system is much better. You'll see hugely improved language-server integration for the view!
macro, including features like doc comments for HTML elements, autocompletion for component properties, clicking to go to the definition of a component, type hints for component arguments, etc.
Inline documentation in the #[component]
macro
You can now document components and their properties directly in the #[component]
macro like this:
/// A simple counter component.
///
/// You can use doc comments like this to document your component.
#[component]
pub fn SimpleCounter(
cx: Scope,
/// The starting value for the counter
#[prop(optional)]
initial_value: i32,
/// The change that should be applied each time the button is clicked.
step: i32
) -> impl IntoView {
// ...
}
The macro will automatically generate docs for the components and for each of its props.
#[prop]
attributes for component props
You can use the #[prop]
attribute macro to mark component props in several ways:
#[prop(optional)]
: this property is not required, and will default toDefault::default()
if you don't provide it in the view#[prop(into)]
:.into()
will be called to convert the arguments provided in the view you can specify, to save you adding.into()
in your views
And much more!
- Comments that mark component boundaries for easier debugging, when in debug mode
- Removing the need to wrap things that
<Router/>
in a<div>
for no obvious reason - and all sorts of things I'm forgetting!
Breaking Changes
Here are a few things to watch out for as you migrate:
- All component functions should now return
-> impl IntoView
- The
<For/>
component now takes aview
property, instead of you passing the view function as the child of the component - Likewise, the
<Route/>
component takes aview
property instead ofelement
for consistency children
properties are now typedBox<dyn Fn(Scope) -> Fragment>
- The
view!
macro returns distinct structures, which are all different types. In other words, this code no longer compiles
// this won't work
if some_condition {
view! { cx, <p>"P if true"</p> }
} else {
view! { cx, <span>"SPAN if false"</span> }
}
because the first branch now returns HtmlElement<P>
while the second returns HtmlElement<Span>
.
In this case, simply add .into_any()
to each to return HtmlElement<AnyElement>
from both. In general, you can always call .into_view(cx)
to return a wrapping View
type instead.
// this works
if some_condition {
view! { cx, <p>"P if true"</p> }.into_any()
} else if something_else {
view! { cx, <span>"SPAN if false"</span> }.into_any()
}
Outstanding Issues (in progress)
- The
<Transition/>
component doesn't quite work properly yet. - SSR + hydration is slightly broken if you use
create_resource
and read it without using<Suspense/>
- There may be some bugs in SSR + hydration in release mode, as this has not been fully tested yet
- SSR is temporarily slower than the current version, as I haven't implemented the fast-path in the
view!
macro yet - Merge over
stable
support forleptos_router
andleptos_meta