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

Inconsistencies with --cfg=erase_components #3156

Open
sabify opened this issue Oct 24, 2024 · 3 comments
Open

Inconsistencies with --cfg=erase_components #3156

sabify opened this issue Oct 24, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation

Comments

@sabify
Copy link
Contributor

sabify commented Oct 24, 2024

Describe the bug
By using --cfg=erase_components in RUSTFLAGS, leptos ignores attr: in components and nothing will be applied.

Leptos Dependencies
leptos = "0.7.0-rc0"

Steps to reproduce the behavior:

  1. use RUSTFLAGS="--cfg=erase_components" cargo leptos serve
  2. Add an attribute to a component: <ActionForm attr:class="xyz">
  3. On serve, no class attribute is added

Expected behavior
The class attribute should be added to the component.

@gbj gbj added the documentation Improvements or additions to documentation label Oct 24, 2024
@gbj
Copy link
Collaborator

gbj commented Oct 24, 2024

This is unfortunate but known. After much work I was not able to support adding arbitrary attributes to AnyView without causing difficult-to-reproduce linker crashes on larger projects. You can read the length discussion beginning here.

You can add #[component(transparent)] to components that need to support attribute spreading and that should work.

@zakstucke
Copy link
Contributor

zakstucke commented Oct 25, 2024

@gbj maybe for now we should enable the dodgy impl when --cfg=erase_components is turned off? At the moment I suppose this would affect release builds when into_any() is legitimately used.

@gbj
Copy link
Collaborator

gbj commented Oct 26, 2024

@zakstucke To the best of my knowledge, there has never been a non-todo!() implementation of AddAnyAttr for AnyView that did not lead to linker errors. If anyone has a fix for that, I will be very excited!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants