-
-
Notifications
You must be signed in to change notification settings - Fork 923
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
Rewrite all the dioxus_elements
logic for more modular hotreload
support
#3318
base: main
Are you sure you want to change the base?
Conversation
465b6a3
to
f878665
Compare
f878665
to
f257529
Compare
ROADMAP:
|
First difficulty: where must the element namespace be static, and when does it have to do dynamic ? Right now, the fileds of |
Right now, the hotreloading is enabled by the following trait (https://github.com/DioxusLabs/dioxus/blob/main/packages/core-types/src/hr_context.rs): pub trait HotReloadingContext {
fn map_attribute(
element_name_rust: &str,
attribute_name_rust: &str,
) -> Option<(&'static str, Option<&'static str>)>;
fn map_element(element_name_rust: &str) -> Option<(&'static str, Option<&'static str>)>;
} Meaning that the namespace of the attribute depends on the parent element. If we have to call I have to find a way to compress it, like pointing to an attribute inside the definition of an element |
We currently leak the string in debug mode during hot reloading. Templates are fairly small and the leak only happens in debug mode, so it hasn't been an issue so far, but we have also discussed switching to Currently, the CLI sends a HotReloadedTemplate message to the front end for hot reloading. That is then combined with the dynamic pool to create a full VNode
The svg and global attributes traits could be pulled out into a separate "attribute group" section with a name and then each element could include one or more attribute group. For example, a |
Ok so something like
|
I think I will split the macro functionality into 2:
#[derive(dioxus::ElementSpecification)]
mod div {
static NAME_SPACE: &'static str = "div";
static TAG_NAME: Option<&'static str> = None;
use x::*;
static x: Attribute = (...);
}
#[derive(dioxus::AttributeGroupSpecification)]
mod svg_element {
static x: Attribute = (...);
} |
It is very much a draft.
For now, this channel is mainly a way for me to write down my reasoning about what has to be done.
The final goal of this PR is to get to a state where:
dioxus_elements
in scopeHotReloadCtx
trait)I also have a different PR #3274 that generates the elements spec with codegen, and this work is almost usable right now. I will have to merge the 2 at one point.