Skip to content

Releases: leptos-rs/leptos

v0.6.12

02 Jun 18:27
@gbj gbj
2ef27cb
Compare
Choose a tag to compare

This is mainly a maintenance release, but includes a couple new features that I want to point out:

impl Trait in Component Props

You can now use impl Trait syntax directly in component props, rather than explicitly specifying a generic and a where clause

before

#[component]
fn ProgressBar<F>(#[prop(default = 100)] max: u16, progress: F) -> impl IntoView
where
    F: Fn() -> i32 + 'static,
{
    view! {
        <progress
            max=max
            value=progress
        />
    }
}

after

#[component]
fn ProgressBar(
    #[prop(default = 100)] max: u16,
    progress: impl Fn() -> i32 + 'static,
) -> impl IntoView {
    view! {
        <progress
            max=max
            value=progress
        />
    }
}

Support spreading dynamic attributes from one component to another

In the following code Bar doesn't currently inherit attributes from Foo when it spreads its attributes. PR #2534 fixes this.

fn main() {
    let (count, set_count) = create_signal(0);

    mount_to_body(move || {
        view! {
            <Foo
                attr:hello=move || count.get().to_string()
            />

            <button on:click=move|_| { set_count.update(|count| *count += 1) }>"+ count"</button>
        }
    });
}

#[component]
fn Foo(#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>) -> impl IntoView {
    view! {
        <Bar {..attrs} />
    }
}

#[component]
fn Bar(#[prop(attrs)] attrs: Vec<(&'static str, Attribute)>) -> impl IntoView {
    view! {
        <div {..attrs}>"hello world"</div>
    }
}

Complete Changelog

New Contributors

Full Changelog: v0.6.11...v0.6.12

v0.7.0-preview2

29 Apr 01:13
@gbj gbj
9353316
Compare
Choose a tag to compare

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
  • The renderer and IntoView trait work quite differently from before. In general, for type-erased views (.into_view() previously) you can use .into_any() or the Either:: types. Storing a View in a signal, cloning it, etc. are not viable approaches any more: store data in signals and rendering views, rather than storing views in signals.
  • 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

  • Actix integration (the playground uses Axum)
  • on: on components (e82227a)
  • spreading attributes onto components (e82227a)
  • MaybeSignal
  • Signal::with()
  • cargo-leptos hot reloading
  • 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
  • Add a !Send/!Sync thread-local arena for browser-type signals

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,

v0.6.11

11 Apr 19:56
@gbj gbj
Compare
Choose a tag to compare

The primary purpose of this release is that it includes a fix for an unfortunate memory leak when using leptos_router on the server.

Also included are

  • the ability to spread both attributes and event handlers onto an element (see the new spread example for the full set of possibilities)
  • implementing IntoView directly for Rc<str>
  • massive improvements to the spans for error reporting in the view macro
  • migrating all our examples to use the stable features/syntax by default, to reduce confusion for new users

It's important to me to say that all three of the new features above were implemented by community members. This release brings us to over 250 total contributors over time, not to mention everyone who's done work on docs, templates, or libraries that exist outside this repo. Thank you to everyone who's been involved in this project so far.

What's Changed

New Contributors

Full Changelog: v0.6.10...v0.6.11

v0.6.10

02 Apr 13:48
@gbj gbj
Compare
Choose a tag to compare

Mostly a patch release with a number of bugfixes, as well as some nice quality-of-life improvements:

  • allowing #[prop(attrs)] on slots
  • add support for on: to dynamic children of components (i.e., when you do <MyComponent on:.../>, the event listener is now applied correctly to more of the children of <MyComponent/>)

What's Changed

New Contributors

Full Changelog: v0.6.9...v0.6.10

v0.6.9

05 Mar 02:16
Compare
Choose a tag to compare

Mostly this release exists to fix imports in Cargo, as well as a few minor bug fixes

What's Changed

New Contributors

Full Changelog: v0.6.8...v0.6.9

v0.6.8

03 Mar 08:06
Compare
Choose a tag to compare

Mostly this release is to disable file hashing by default, and streamline it's use. It can now be enabled by setting hash-files=true in your Cargo.toml or setting the LEPTOS_HASH_FILES=true env var when running cargo-leptos. If you're using Docker or moving the bin to a new folder, you need to copy the (by default) hash.txt file from target/{release_profile_name} to the same folder as your binary, and make sure the env var or cargo.toml option is enabled. Also some minor bug fixes

What's Changed

  • Specify path to wasm bindgen in island macro by @Baptistemontan in #2387
  • add note on how to get leptos_axum::ResponseOptions by @sjud in #2380
  • fix(ci): "needless borrow" error and example never exiting by @paul-hansen in #2392
  • fix: ignore this Axum integration as with other doctests for now by @gbj in #2395
  • Unnecessary trait bound PartialEq removed from create_owning_memo by @zroug in #2394
  • fix: correctly reset hydration status in islands mode Suspense (closes #2332) by @gbj in #2393
  • Rename env var and tweak hashing to align with cargo leptos by @benwis in #2398

New Contributors

Full Changelog: v0.6.7...v0.6.8

0.6.7

29 Feb 21:42
Compare
Choose a tag to compare

Hello everyone! Some lovely changes in here. My favorite is the addition of version hashes to css,js, and wasm files to automatically invalidate browser caching issues. Be sure to update to the latest version of cargo leptos(v0.2.8) to test out this feature. As always, big thanks to our returning contributors and welcome to the new folks!

What's Changed

  • feat: Add owning memos to allow memos that re-use the previous value by @pheki in #2139
  • feat: add impl_from argument to #[server] proc_macro by @videobitva in #2335
  • Make it so that cancelled timeouts don't leak by @rjmac in #2331
  • Update suspense_component.rs documentation to use .get() instead of .… by @sjud in #2346
  • add comment specifying edgecase of server function prefixes by @sjud in #2345
  • feat(leptos-axum): propagate trace context to server functions by @janu-cambrelen in #2340
  • finish doc sentence by @sjud in #2348
  • Fix Broken Doc links and Deprecate FromUtf8Error in oco.rs by @zoomiti in #2318
  • ci(examples): build hackernews_js_fetch with deno by @agilarity in #2344
  • chore(ci): fix failing CI by removing deprecation note by @gbj in #2362
  • Trailing slashes (#2154) take 2 by @skirsdeda in #2217
  • feat: add method to RouteContext (#1808) by @zoomiti in #2315
  • Replace Resrouce::read() in doc examples with Resource::get() by @sjud in #2372
  • fix: do not strip query in redirect hook when using client-side navigation by @haslersn in #2376
  • added hashes generated from cargo-leptos by @maccesch in #2373
  • Add MSRV by @paul-hansen in #2360

New Contributors

Full Changelog: v0.6.6...v0.6.7

v0.6.6

19 Feb 21:55
Compare
Choose a tag to compare

Fixed some issues with examples, integrated a server macro for Spin, and improved a number of typos. Thanks to all that participated!
For general 0.6 release notes, see here.

What's Changed

  • Update rkyv example button text to accurately reflect what it does by @Innominus in #2250
  • example/counter_isomorphic Removed console warning. by @martinfrances107 in #2244
  • Chore: Minor, ran cargo fmt by @martinfrances107 in #2254
  • examples/hackernews: Add a "Suspense" wrapper. by @martinfrances107 in #2253
  • fix: error rather than panicking if unable to send response in Axum integration by @gbj in #2241
  • docs: fix broken link in leptos_router by @nootr in #2256
  • Adding a Beginner's Tip to HtmlElement by @sjud in #2218
  • Percent Decode Url Parameters by @zoomiti in #2251
  • feat(axum): provide state to server fn context by @chrisp60 in #2257
  • Fix typo in actix integrations docs by @SleeplessOne1917 in #2258
  • docs: typos in examples by @ngutech21 in #2260
  • fix: guarantee execution order of effects (closes #2261) by @gbj in #2262
  • fix: make directive .into() calls consistent by @blorbb in #2249
  • chore: fix typo by @saikatdas0790 in #2267
  • Create an axum-no-default feature for server_fn and sets leptos_axum to rely on it instead. by @sjud in #2270
  • fix: add key/value pair from submit button when parsing form event by @haslersn in #2268
  • fix(ci): address clippy issue by @agilarity in #2278
  • fix(test-report) should show all cargo-make leptos configuration by @agilarity in #2282
  • Fix remaining CI issues by @gbj in #2285
  • docs: give a warning when you try to .dispatch() an action immediately (closes #2225) by @gbj in #2286
  • fix(ci): empty directory vector error by @agilarity in #2288
  • fix(examples): align crate name and output name (closes #2206) by @gbj in #2291
  • pub export server is either from leptos_macro or leptos_spin_macro depending on if spin feature is enabled. by @sjud in #2280
  • ci(examples): configure leptos examples to build with cargo-leptos when possible by @agilarity in #2294
  • session_auth_axum compiles and works again by @drebbe-intrepid in #2310
  • I have been looking the "github actions" build warnings. by @martinfrances107 in #2303
  • fix(meta): provide meta context missing in example by @EstebanBorai in #2311
  • Error type detection only worked without type path by @maccesch in #2298
  • feat: use cdn url for static assets (#2281) by @zoomiti in #2283
  • Bumping config to 0.14. by @martinfrances107 in #2302
  • fix: Transition in hydrate mode that isn't initially created (closes #2279) by @gbj in #2314
  • docs(examples): update docs by @agilarity in #2313
  • docs: log error on failing to convert form to ServerFn type, in addition to setting action value by @gbj in #2319
  • chore(ci): reduce set of tested features to prevent running out of disk space in server_fn by @gbj in #2320
  • examples: fix CSS file name in tailwind_axum by @gbj in #2324
  • fix: handle cross-origin redirects in server function redirect hook by @haslersn in #2329
  • Fixed href path in tailwind_csr example by @itsDrac in #2328

New Contributors

Full Changelog: v0.6.5...v0.6.6

0.6.5

01 Feb 01:37
@gbj gbj
Compare
Choose a tag to compare

This fixes a few bugs that have popped up since 0.6. For general 0.6 release notes, see here.

What's Changed

  • fix: bug with Actix redirects by @gbj in #2246
  • feat: easily create custom server fn clients by @gbj in #2247

Full Changelog: v0.6.4...v0.6.5

0.6.4

30 Jan 16:08
@gbj gbj
Compare
Choose a tag to compare

This fixes a few bugs that have popped up since 0.6.3. For general 0.6 migration notes, see here.

What's Changed

  • chore: define edtion = "2021" in rustfmt.toml by @chrisp60 in #2235
  • fix: correctly track source in create_local_resource (closes #2237) by @gbj in #2238
  • example: file upload with streaming progress bar by @gbj in #2242
  • fix: serialization error during SSR on ServerFnError by @gbj in #2240

Full Changelog: v0.6.3...v0.6.4