Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement AddAnyAttr trait for Static<V> #3463

Open
geoffreygarrett opened this issue Jan 9, 2025 · 0 comments · May be fixed by #3464
Open

Implement AddAnyAttr trait for Static<V> #3463

geoffreygarrett opened this issue Jan 9, 2025 · 0 comments · May be fixed by #3464

Comments

@geoffreygarrett
Copy link

Is your feature request related to a problem? Please describe.

Yes, the AddAnyAttr trait is not implemented for Static<V>, resulting in compiler errors when attempting to add attributes to static strings.

#[component]
fn A(children: Children) -> impl IntoView {
    view! { {children()} }
}
#[component]
fn B() -> impl IntoView {
    view! {
        <A attr:class="x">
            "Test"
        </A>
    }
}

Describe the solution you'd like

Implement the AddAnyAttr trait for Static<V> so that adding an attribute returns the static string unchanged, ensuring type safety and compatibility.

Additional context

It's a small edge case that doesn't really need action, but for the sake of polish, might be nice.

geoffreygarrett pushed a commit to geoffreygarrett/leptos that referenced this issue Jan 9, 2025
@geoffreygarrett geoffreygarrett linked a pull request Jan 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant