cargo leptos 0.3.0
`v0.3.0`

latest releases: 0.7.0-rc1, 0.7.0-rc0, 0.7.0-preview2...
18 months ago

v0.3.0 is another incremental-ish release with a bunch of new features, many on the server end but including a bunch of general-purpose improvements. It includes several things that are breaking changes in the semantic-versioning sense, but you may find that not much breaks in your actual app. (For example, no code in any of the the three starter templates needed to change.)

New Features and Small Fixes

General

  • No longer necessary to import __Props types for components; you can just use app::MyComponent; instead of app::{MyComponent, MyComponentProps};
  • #[slot] syntax to define typed component children.
  • Typed events in window_event_listener
  • Optional event listeners with HtmlElement::optional_event
  • Adds style: syntax in the view macro to set individual styles, much like class: sets individual classes
  • Simplify work with resources by adding a Resource::update method to reactively update current value.
  • expect_context::<T>(cx) shorthand for use_context::<T>(cx).unwrap()

Server

  • Support for server functions that use GET requests (with either URL or CBOR encoding), for easier caching.
  • extract helper to directly use Actix extractors in a server function.
  • Allow more complex data like structs and Vec<_> as server function arguments (anything that can be de/serialized by serde_qs)
  • Support for rendering a <Route/> in response to additional HTTP methods/verbs, e.g., the classic PHP/multi-page-app style in which a POST request can be sent to a page and it will render a response. (See methods prop.)
  • Support for SsrMode::PartiallyBlocked which works like out-of-order streaming but replaces the HTML for any “blocked” fragments on the server. Improves UX when JS is disabled.

Developer Experience and Ergonomics

  • Top-to-bottom integration with the tracing crate
  • Adding some "real-time docs" via several runtime warnings and compile-time errors to prevent common bugs (for example, using leptos_meta with no features enabled or accidentally ending the view a component returns with a semicolon, meaning it renders nothing)

Performance

  • Improve performance of Axum integration by spawning requests into a local threadpool.
  • Improve performance of router on the server side by caching branch generation.
  • Performance improvements in the reactive system and renderer, and closing a memory leak in <Suspense/>/<Transition/>.

And as always...

  • Lots of bug fixes! Full changelog below.

Breaking Changes

  • &'a str can no longer be directly rendered as a view: add .to_string() to effected variables. (Previously, all &str were converted to String by the renderer; using Cow<'static, str> now allows &'static str to be rendered without the additional allocation, at the cost of requiring the conversion of &str to String to be more explicit.)
  • window_event_listener now takes a typed event (like ev::keypress). Use window_event_listener_untyped for the old behavior.
  • When deriving Params to use typed router search/params, the FromStr error for any type needs to be Send + Sync so they are ErrorBoundary compatible
  • Generics in create_slice have changed to allow different input types for getter/setter; only relevant if (for some reason?) you were specifying them manually.
  • Exact interfaces for a few public-but-rarely-needed functions in the server integrations have changed.

What's Changed

  • Fix server functions default macro on stable by @Demonthos in #784

  • docs: add runtime "strict mode" checks that warn if you’re non-reactively accessing a value by @gbj in #786

  • fix: warnings about untracked signal access in <Router/> by @gbj in #790

  • Remove unused fs dependency from leptos_config by @valeth in #787

  • fix: untrack should disable warnings about untracked reads by @gbj in #791

  • fix: nested <Suspense/> by @gbj in #781

  • docs: <Form/> component by @gbj in #792

  • Fix server functions with non-copy server contexts by @Demonthos in #785

  • fix: unused warning on cx in server functions by @markcatley in #794

  • docs: warn if you are using leptos_meta without features by @gbj in #797

  • fix: warning in Cargo.toml by @markcatley in #800

  • feat: Add ability to include options to event listeners by @Ofenhed in #799

  • fix: fixes #802 as a temporary measure without resorting to #803 yet by @gbj in #804

  • fix: prevent router panic on root-level <Redirect/> during route list generation by @gbj in #801

  • Reduce size of RuntimeId when slotmap is not used by @novacrazy in #805

  • fix: unused warning in reactive signal diagnostics by @markcatley in #807

  • Add the ability for server fns to be submitted via GET requests by @benwis in #789

  • chore: fix unused variable warning in property now that it's not memoized by @gbj in #810

  • Optimize Runtime::mark_dirty by @novacrazy in #808

  • Optimize memory usage of update methods by @novacrazy in #809

  • fix: correctly escape HTML special characters in text nodes during SSR by @gbj in #812

  • Publish book ci by @bram209 in #817

  • remove Leptos guide link by @bram209 in #818

  • docs: add sandbox links and max height by @gbj in #824

  • fix: correctly pass server fn errors to client by @gbj in #822

  • fix: server functions with url as argument name (closes issue #823) by @gbj in #825

  • chore: deny warnings on github actions by @markcatley in #814

  • Use local pools for axum handlers by @akarras in #815

  • tests: update benchmarks by @gbj in #827

  • feat: make __Props imports unnecessary (closes #746) by @gbj in #828

  • Various optimizations, size reductions and stability improvements by @novacrazy in #831

  • Fix leaked memo nodes by @novacrazy in #841

  • [Fix] Correct broken MaybeSignal link by @hoangph271 in #840

  • feat: rustls feature for reqwest and any other relevant dependencies by @gbj in #842

  • fix: don't entity-encode HTML special characters inside <script> or <style> (closes #837) by @gbj in #846

  • feat: allow multiple HTTP request methods/verbs by @gbj in #695

  • [WIP] Trigger prototype by @novacrazy in #838

  • fix static text nodes with curly braces in SSR by @gbj in #849

  • docs: emit error when trying to combine global class and dynamic class in a bugged way by @gbj in #850

  • fix: custom events in SSR mode by @gbj in #852

  • fix: Strip & from the end of params queries by @mondeja in #854

  • fix: match statement in leptos book by @chroth7 in #860

  • Fix the counter without macros test by @agilarity in #863

  • feat: add ability to set node_ref and pass additional attributes to <Form/> and friends by @gbj in #853

  • Fixed typo in life cycle docs by @Stackingttv in #869

  • examples: fix error handling in fetch example by @gbj in #870

  • feat: add the ability to specify animations on route transitions by @gbj in #736

  • [fix] updated nix flakes lock files on session auth axum examples by @mustafasegf in #872

  • docs: Add per-project toolchain override readme by @kamilogorek in #876

  • feat: add non-animation base classes to <AnimatedOutlet/> and <AnimatedRoutes/> by @gbj in #877

  • Use override key, if available, for server function calling by @snapbug in #878

  • feat: add expect_context function by @markcatley in #864

  • fix: rendering error in SSR InOrder/Async Mode by @hjin-me in #879

  • Split counter without macros web test by @agilarity in #884

  • fix: dispose of scope when server fns return error by @gbj in #888

  • perf: tiny optimization on primitive child values by @gbj in #887

  • chore(readme): add link to Matrix bridge by @filipdutescu in #894

  • Fixes #890 that was using OnceLock, which is nightly only, by adding the once_cell crate as a dependency. by @OvermindDL1 in #891

  • This should solve ParamsMap / LinearMap serde serialization and deserialization #892 by @dgsantana in #895

  • feat: add ability to mutate resources by @gbj in #886

  • fix: erroneous non-reactive access warning in undelegated events by @gbj in #900

  • perf: improve router performance on server by calculating route branches once by @gbj in #898

  • Added get_untracked for node_ref. by @dgsantana in #902

  • Use cargo make to run tests for examples by @agilarity in #904

  • Add a window event listener with a callback that receives an event that has been cast to its non-generic type. by @loganbnielsen in #910

  • docs: compile error on mutually-exclusive features by @gbj in #911

  • fix: issue with ordering of class attribute and class=("fancy-name-200", true) (closes #907) by @gbj in #914

  • change: add window_event_listener_untyped and deprecate window_event_listener pending 0.3.0 by @gbj in #913

  • feat: add slots by @yuuma03 in #909

  • examples: fix broken counters tests by @gbj in #915

  • fix some issues with animated routing by @gbj in #889

  • fix: panic when creating nested StoredValue by @gbj in #920

  • Tracing Updates by @benwis in #908

  • docs: fixed a minor typo in async readme by @escwxyz in #921

  • docs: removed extra unused code blocks in form.md by @escwxyz in #923

  • docs: fixed typo in interlude_styling.md by @escwxyz in #924

  • fix: features related compile error by @agilarity in #919

  • fix: allow nested slots by @yuuma03 in #928

  • docs: add some content on server-side rendering by @gbj in #930

  • chore: specify dependency version for cached by @rodrigc in #929

  • Remove need for LEPTOS_OUTPUT_NAME env var after compilation by @benwis in #899

  • Added (potentially broken) timer example by @bluenote10 in #925

  • Link to actual type instead of Into trait for component properties by @ModProg in #932

  • feat: add allow missing_docs to children field by @ModProg in #934

  • Adds the GetCbor and GetJson to server macro documentation. by @dgsantana in #938

  • Fix ServerFnError::Serialization error string by @mtsr in #939

  • examples: better practice for view types in todos by @gbj in #940

  • CI: fix unused variables breaking tests by @gbj in #950

  • fix: generics on impl From slot to Vec<slot> by @yuuma03 in #946

  • feat: add Actix extract helper by @gbj in #936

  • Test business logic for counter_without_macros by @agilarity in #927

  • impl IntoView for component props by @jquesada2016 in #948

  • impl FromIterator for View by @ModProg in #945

  • Add From for RequestParts into Parts for Axum and add an option to ge… by @benwis in #931

  • fix: <ErrorBoundary/> toggling between states (closes issue #820) by @gbj in #957

  • docs: add note on projecting children by @gbj in #959

  • fix: escapes in doc comments on component properties by @ModProg in #958

  • Add wasm web test and common tasks by @agilarity in #954

  • docs: note need for serde dependency for server functions (closes #947) by @gbj in #962

  • fix: use a HashMap on Branches::initialize by @yuuma03 in #966

  • chore: fix typos by @fattenap in #964

  • feat: add collect_view(cx) by @ModProg in #956

  • 
    
  • v0.3.0-alpha by @gbj in #968

  • Replace serde_urlencoded with serde_html_form to support cross-input vec serverfn by @snapbug in #973

  • change/fix: require FromStr errors on Params to be Send + Sync so they are ErrorBoundary compatible by @gbj in #974

  • Fix the lint issues in the counter example by @agilarity in #971

  • feat: add builder syntax for optional event listener by @gbj in #969

  • Fix lint issues in counter_isomorphic example by @agilarity in #980

  • fix: suppress warning loading local resource without <Suspense/> in hydrate mode (closes #979) by @gbj in #984

  • feat: allow structs in server function arguments by @gbj in #987

  • docs: switch from compile errors to runtime warnings for incompatible feature flags by @gbj in #990

  • docs: error when component ends with view! { ... }; (closes #985) by @gbj in #993

  • fix: lint issues in counters example by @agilarity in #986

  • fix: lint issues in erros_axum example by @agilarity in #988

  • fix: lint issues in fetch example by @agilarity in #989

  • fix: lint issues in hackernews example by @agilarity in #991

  • fix: lint issues in hackernews_axum example by @agilarity in #992

  • fix: lint issues in login_with_token_csr_only example by @agilarity in #995

  • fix: lint issues in router example by @agilarity in #996

  • fix: lint issues in session_auth_axum example by @agilarity in #997

  • fix: lint issues in todo_app_sqlite example by @agilarity in #998

  • fix: lint issues in todo_app_sqlite_axum example by @agilarity in #999

  • fix: lint issues in todo_app_sqlite_viz example by @agilarity in #1000

  • fix: lint issues in todomvc example by @agilarity in #1001

  • [docs] Reduce firmness of overlapping signal warning by @dglsparsons in #1004

  • docs: document that <ActionForm/> only works with form-encoded server functions by @gbj in #1005

  • fix: properly dispose of <Suspense/> scopes (closes #834) by @gbj in #1006

  • test: lint examples with --all-features by @agilarity in #1008

  • feat: add style: to view by @gbj in #1009

  • Relax Debug trait bounds by @Wadu436 in #1010

  • docs: add a server fn section by @gbj in #1014

  • book: close iframe tag on global state management page by @Wadu436 in #1013

  • docs: adjust Dynamic Attributes page by @FrankReh in #1011

  • book: fix link to cargo-leptos README by @Wadu436 in #1012

  • docs: add examples for manual server integration by @ChristopherPerry6060 in #1015

  • Clean up examples after verification by @agilarity in #1019

  • build tailwind CSS with trunk by @agilarity in #1016

  • [fix] indentation erros in examples by @hoangph271 in #1017

  • fix: maintain insertion order of meta tags by @gbj in #1021

  • fix: corrects error-deserialization behavior of ActionForm (closes #1024) by @gbj in #1025

  • feat: SsrMode::PartiallyBlocked by @gbj in #1026

  • fix: flicking <Transition/> in release mode (closes #960) by @gbj in #1030

  • fix: avoid extra { escaping (closes #1035) by @gbj in #1038

  • change: remove APIs that had been marked deprecated by @gbj in #1037

  • Update slice.rs by @sjud in #1036

  • examples: fix trunk config to run tailwind at the right time by @flosse in #1040

  • Migrate axum integration to use with_state over layer(Extension by @snapbug in #1032

New Contributors

Full Changelog: v0.2.5...v0.3.0

Don't miss a new leptos release

NewReleases is sending notifications on new releases.