sycamore icon indicating copy to clipboard operation
sycamore copied to clipboard

Inline props does not properly support patterns

Open lukechu10 opened this issue 1 year ago • 2 comments

Describe the bug Using #[component(inline_props)] does not properly account for using patterns in function parameters.

To Reproduce

#[component(inline_props)]
fn Foo(mut value: i32) -> View {
    view! {}
}

The problem occurs when generating code for the prop struct. This is what ends up being generated currently:

#[derive(Props)]
struct FooProps {
    mut value: i32
}

where the mut is obviously out of place.

Expected behavior Patterns work seamlessly with #[component(inline_props)]

Environment

  • Sycamore: master

Additional information Relevant file is packages/sycamore-macro/src/component.rs, specifically the inline_props_impl function.

lukechu10 avatar Oct 12 '24 15:10 lukechu10

@lukechu10 i can work on this

KekmaTime avatar Oct 12 '24 22:10 KekmaTime

@lukechu10 i can work on this

Great! Let's me know if you run into any issues.

lukechu10 avatar Oct 13 '24 06:10 lukechu10