v0.6.12
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
- Update spin_sdk to spin v3 by @benwis in #2525
- Add beginner tip to ErrorBoundary by @sjud in #2385
- Minor: Bumped serde_qs to 0.13. by @martinfrances107 in #2512
- fix: do not submit
<ActionForm>
onformmethod="dialog"
submission (closes #2523) by @gbj in #2531 - Add id to ActionForm and MultiActionForm by @benwis in #2535
- Minor: Bumped trunk-action to 0.5. by @martinfrances107 in #2533
- chore: publish
Oco
separately asoco_ref
crate so that it can be used elsewhere by @gbj in #2536 - Adding Russian book branch by @solweo in #2516
- fix: make TextProp's IntoView and IntoAttribute impls reactive by @0e4ef622 in #2518
- feat: spread component attrs by @Upbolt in #2534
- docs: remove unnecessary type parameter and trait bound in component macro 'bad' example by @ethanniser in #2520
- Adds ability to use multiple classes in view macro using array syntax. by @bicarlsen in #2532
- Add 'create_query_signal_with_options' to leptos_router by @kryesh in #2517
- projects directory with 4 projects by @sjud in #2500
- docs: add caveats for ProtectedRoute by @gbj in #2558
- Update leptos-spin-macro reference by @itowlson in #2570
- Minor: examples/server_fns_axum FileWatcher logs errors to the console. by @martinfrances107 in #2547
- Add an example for generating sitemaps by @JoeyMckenzie in #2553
- Added an Index to Project README by @sjud in #2555
- added project by @sjud in #2556
- docs: clarify the purpose of local resources by @gbj in #2543
- Use trunk built-in way of handling tailwind by @SleeplessOne1917 in #2557
- Debug NodeRef Warning (#2414) by @martinfrances107 in #2467
- feat: add
input_derive
parameter to#[server]
macro (closes #2544) by @luxalpa in #2545 - Fix
empty_docs
warnings in#[component]
macro by @abusch in #2574 - fix: don't insert empty child for comment/doctype (closes #2549) by @gbj in #2581
- fix: allow temporaries as props (closes #2541) by @gbj in #2582
- The counter example, with Dwarf debugging (breakpoints, single stepping in vscode and the browser) by @Hecatron in #2563
- fix: StoredValue and Resource panic during cleanup by @luxalpa in #2583
- fix: only issue NodeRef warning in debug mode (necessary to compile in
--release
) by @gbj in #2587 - fix: grammar typo for MultiActon doc comment by @pitoniak32 in #2589
- Example using the bevy 3d game engine and leptos by @Hecatron in #2577
- feat:
#[component]
now handlesimpl Trait
by converting to generic type params, fix #2274 by @MingweiSamuel in #2599 - Allow slice! macro to index tuples by @SleeplessOne1917 in #2598
- fix: URL encoding issue (closes #2602) by @luxalpa in #2601
New Contributors
- @0e4ef622 made their first contribution in #2518
- @ethanniser made their first contribution in #2520
- @bicarlsen made their first contribution in #2532
- @kryesh made their first contribution in #2517
- @JoeyMckenzie made their first contribution in #2553
- @abusch made their first contribution in #2574
- @Hecatron made their first contribution in #2563
- @pitoniak32 made their first contribution in #2589
- @MingweiSamuel made their first contribution in #2599
Full Changelog: v0.6.11...v0.6.12