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

Cannot have 2 events that are perfectly the same #1

Closed
Champii opened this issue Oct 21, 2022 · 0 comments
Closed

Cannot have 2 events that are perfectly the same #1

Champii opened this issue Oct 21, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@Champii
Copy link
Owner

Champii commented Oct 21, 2022

Writing a component with twice the same event fails at compile time.
It causes a conflict in the generation of the Msg, as it currently uses a hash of the event's code token tree.
There is no easy resolution for this as the Msg event id must be deterministic.

We could hash the children's code with it, but that would invalidate any loop-generated component.
Another idea would be to have an incremental id in the macro's scope that would serve as a salt, but this is not easy either due to the multi-dimensional nature of the self-expanding html_macro!{}

This fails at compile time:

component! {
  i32,
  div {
    div @click: { *self += 1 } {}
    div @click: { *self += 1 } {}
  }
}
@Champii Champii added the bug Something isn't working label Oct 21, 2022
Champii added a commit that referenced this issue Oct 22, 2022
@Champii Champii closed this as completed Oct 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant