-
-
Notifications
You must be signed in to change notification settings - Fork 695
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
feat: directives #1821
feat: directives #1821
Conversation
This looks very good to me, and thanks for taking it on! The only question I have is whether implementing it using |
Ok I see. I guess in combination with the only-run-once of |
So I did a bit more research how Solid does directives and they even say in the docs that it's just syntactic sugar for a node ref. They execute them before mounted. So I think it makes sense to make our directives just syntactic sugar for let the_ref = create_node_ref();
create_effect(move || {
if let Some(the_ref) = the_ref.get() {
directive_func(the_ref, possibly_some_param);
}
}); That makes the implementation rather straight forward, is easy to understand for the user and we're 100% covered because we don't guarantee mounted and let users do whatever they want. Do you agree? |
Agreed, this implementation looks good to me! |
``` The following actions uses node12 which is deprecated and will be forced to run on node16: actions-rs/toolchain@v1. For more info: https://github.blog/changelog/2023-06-13-github-actions-all-actions-will-run-on-node16-instead-of-node12-by-default/ ``` In other places @3 was being used, so for consitency I have bumped everything up to @4 - uses: actions/checkout@v3 + uses: actions/checkout@v4
…lve client side error (leptos-rs#1834)
# Conflicts: # leptos/src/lib.rs
@gbj I think this is ready |
This looks really great! My only question was about whether it made sense to have Thanks for this really useful PR! |
Thanks! |
Fixes #1668.
This isn't finished yet but I think it makes the idea clear.
You'd define your directives as functions.
Then in the view template:
Should I finish this? Should I do sth different?