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 Attribute for Either<A, B> #3556

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

alexisfontaine
Copy link
Contributor

@alexisfontaine alexisfontaine commented Feb 6, 2025

This implementation allows to define HtmlElement<Tag, (Either<FooAttribute, BarAttribute>,), Children> as the output of a fully-typed reusable component.

The current workaround of having to write Either<HtmlElement<Tag, FooAttribute, Children>, HtmlElement<Tag, BarAttribute, Children>>, besides being more verbose, also lacks an implementation of ElementExt.

@gbj gbj merged commit 88b1b2d into leptos-rs:main Feb 7, 2025
55 of 74 checks passed
@gbj
Copy link
Collaborator

gbj commented Feb 7, 2025

Thanks!

@alexisfontaine alexisfontaine deleted the feat/impl_attribute_either branch February 7, 2025 13:35
@luxalpa
Copy link
Contributor

luxalpa commented Feb 9, 2025

Sadly, this broke rustflags = ["--cfg=erase_components"] on nightly with a bunch of errors like these:

error[E0277]: the trait bound `(Either<<A as Attribute>::AsyncOutput, ...>,): Attribute` is not satisfied
   --> C:\Users\Luxalpa\.cargo\git\checkouts\leptos-79e4740403520456\88b1b2d\tachys\src\view\either.rs:147:24
    |
147 |     type AsyncOutput = (Either<A::AsyncOutput, B::AsyncOutput>,);
    |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ unsatisfied trait bound

@alexisfontaine
Copy link
Contributor Author

alexisfontaine commented Feb 9, 2025

Hum, have you tried the current release? I just did, and it looks like these errors were introduced between v0.7.4 and v0.7.5. Unfortunately I don't know much about the erase_components config to be able to help...

@luxalpa
Copy link
Contributor

luxalpa commented Feb 9, 2025

There's in fact another error like this in the current release (v0.7.5) which was fixed earlier: #3536

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 this pull request may close these issues.

3 participants