-
Notifications
You must be signed in to change notification settings - Fork 52
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
Hot reloading support #67
Changes from 7 commits
d611f85
e710cdc
860e80d
46a48b4
21e11b6
b09b2f9
9228169
5ffa6c2
55a6480
b3f56b4
2daf322
5c68c8c
5fd1ec4
baed00e
90329db
8165598
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,13 +3,17 @@ name = "dioxus-blitz" | |
version = "0.0.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
[features] | ||
hot-reload = [] | ||
default = [] | ||
|
||
[dependencies] | ||
winit = { version = "0.30.2", features = ["rwh_06"] } | ||
muda = { version = "0.11.5", features = ["serde"] } | ||
tokio = { workspace = true, features = ["full"] } | ||
dioxus = { workspace = true } | ||
dioxus-cli-config = { git = "https://github.com/dioxuslabs/dioxus", rev = "a3aa6ae771a2d0a4d8cb6055c41efc0193b817ef"} | ||
dioxus-hot-reload = { git = "https://github.com/dioxuslabs/dioxus", rev = "a3aa6ae771a2d0a4d8cb6055c41efc0193b817ef"} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These should be optional, based on the |
||
futures-util = "0.3.30" | ||
vello = { workspace = true } | ||
wgpu = { workspace = true } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ use crate::{Node, NodeData, TextNodeData}; | |
// use quadtree_rs::Quadtree; | ||
use selectors::{matching::QuirksMode, Element}; | ||
use slab::Slab; | ||
use std::any::Any; | ||
use std::collections::HashMap; | ||
use style::invalidation::element::restyle_hints::RestyleHint; | ||
use style::selector_parser::ServoElementSnapshot; | ||
|
@@ -37,7 +38,7 @@ impl FontMetricsProvider for DummyFontMetricsProvider { | |
} | ||
} | ||
|
||
pub trait DocumentLike: AsRef<Document> + AsMut<Document> + Into<Document> { | ||
pub trait DocumentLike: AsRef<Document> + AsMut<Document> + Into<Document> + 'static { | ||
fn poll(&mut self, _cx: std::task::Context) -> bool { | ||
// Default implementation does nothing | ||
false | ||
|
@@ -47,6 +48,10 @@ pub trait DocumentLike: AsRef<Document> + AsMut<Document> + Into<Document> { | |
// Default implementation does nothing | ||
false | ||
} | ||
|
||
fn as_any_mut(&mut self) -> &mut dyn Any { | ||
self | ||
} | ||
} | ||
|
||
impl DocumentLike for Document {} | ||
|
@@ -217,7 +222,9 @@ impl Document { | |
|
||
let node = &self.nodes[node_id]; | ||
let node_child_idx = node.child_idx; | ||
let parent_id = node.parent.unwrap(); | ||
|
||
// Get this node's parent, or the root node if it has none. | ||
let parent_id = node.parent.unwrap_or_default(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't seem right. Only the root node should have no parent. And we wouldn't want to insert a child of the root node instead of a sibling. What is the use case here? Replacing the root node? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think this should be necessary. The root node should be |
||
let parent = &mut self.nodes[parent_id]; | ||
|
||
let mut children = std::mem::take(&mut parent.children); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this change be causing the examples not to work correctly?