mirror of
https://github.com/leptos-rs/leptos.git
synced 2025-12-27 15:44:42 -05:00
Compare commits
3 Commits
fix-error-
...
v0.3.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dd8b78336 | ||
|
|
fd901d3e53 | ||
|
|
d517f01e58 |
28
Cargo.toml
28
Cargo.toml
@@ -25,22 +25,22 @@ members = [
|
||||
exclude = ["benchmarks", "examples"]
|
||||
|
||||
[workspace.package]
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
|
||||
[workspace.dependencies]
|
||||
leptos = { path = "./leptos", default-features = false, version = "0.3.0" }
|
||||
leptos_dom = { path = "./leptos_dom", default-features = false, version = "0.3.0" }
|
||||
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.3.0" }
|
||||
leptos_macro = { path = "./leptos_macro", default-features = false, version = "0.3.0" }
|
||||
leptos_reactive = { path = "./leptos_reactive", default-features = false, version = "0.3.0" }
|
||||
leptos_server = { path = "./leptos_server", default-features = false, version = "0.3.0" }
|
||||
server_fn = { path = "./server_fn", default-features = false, version = "0.3.0" }
|
||||
server_fn_macro = { path = "./server_fn_macro", default-features = false, version = "0.3.0" }
|
||||
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", default-features = false, version = "0.3.0" }
|
||||
leptos_config = { path = "./leptos_config", default-features = false, version = "0.3.0" }
|
||||
leptos_router = { path = "./router", version = "0.3.0" }
|
||||
leptos_meta = { path = "./meta", default-features = false, version = "0.3.0" }
|
||||
leptos_integration_utils = { path = "./integrations/utils", version = "0.3.0" }
|
||||
leptos = { path = "./leptos", default-features = false, version = "0.3.1" }
|
||||
leptos_dom = { path = "./leptos_dom", default-features = false, version = "0.3.1" }
|
||||
leptos_hot_reload = { path = "./leptos_hot_reload", version = "0.3.1" }
|
||||
leptos_macro = { path = "./leptos_macro", default-features = false, version = "0.3.1" }
|
||||
leptos_reactive = { path = "./leptos_reactive", default-features = false, version = "0.3.1" }
|
||||
leptos_server = { path = "./leptos_server", default-features = false, version = "0.3.1" }
|
||||
server_fn = { path = "./server_fn", default-features = false, version = "0.3.1" }
|
||||
server_fn_macro = { path = "./server_fn_macro", default-features = false, version = "0.3.1" }
|
||||
server_fn_macro_default = { path = "./server_fn/server_fn_macro_default", default-features = false, version = "0.3.1" }
|
||||
leptos_config = { path = "./leptos_config", default-features = false, version = "0.3.1" }
|
||||
leptos_router = { path = "./router", version = "0.3.1" }
|
||||
leptos_meta = { path = "./meta", default-features = false, version = "0.3.1" }
|
||||
leptos_integration_utils = { path = "./integrations/utils", version = "0.3.1" }
|
||||
|
||||
[profile.release]
|
||||
codegen-units = 1
|
||||
|
||||
@@ -14,16 +14,13 @@ fn simple_ssr_test() {
|
||||
</div>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-8|open--><div \
|
||||
id=\"_0-1\"><button id=\"_0-2\">-1</button><span \
|
||||
assert!(rendered.into_view(cx).render_to_string(cx).contains(
|
||||
"<div id=\"_0-1\"><button id=\"_0-2\">-1</button><span \
|
||||
id=\"_0-3\">Value: \
|
||||
<!--hk=_0-4o|leptos-dyn-child-start-->0<!\
|
||||
--hk=_0-4c|leptos-dyn-child-end-->!</span><button \
|
||||
id=\"_0-5\">+1</button></div><!--leptos-view|leptos-tests-ssr.\
|
||||
rs-8|close-->"
|
||||
);
|
||||
id=\"_0-5\">+1</button></div>"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -54,28 +51,13 @@ fn ssr_test_with_components() {
|
||||
</div>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-49|open--><div id=\"_0-1\" \
|
||||
class=\"counters\"><!--hk=_0-1-0o|leptos-counter-start--><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-38|open--><div \
|
||||
id=\"_0-1-1\"><button id=\"_0-1-2\">-1</button><span \
|
||||
assert!(rendered.into_view(cx).render_to_string(cx).contains(
|
||||
"<div id=\"_0-1-1\"><button id=\"_0-1-2\">-1</button><span \
|
||||
id=\"_0-1-3\">Value: \
|
||||
<!--hk=_0-1-4o|leptos-dyn-child-start-->1<!\
|
||||
--hk=_0-1-4c|leptos-dyn-child-end-->!</span><button \
|
||||
id=\"_0-1-5\">+1</button></div><!--leptos-view|leptos-tests-ssr.\
|
||||
rs-38|close--><!--hk=_0-1-0c|leptos-counter-end--><!\
|
||||
--hk=_0-1-5-0o|leptos-counter-start--><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-38|open--><div \
|
||||
id=\"_0-1-5-1\"><button id=\"_0-1-5-2\">-1</button><span \
|
||||
id=\"_0-1-5-3\">Value: \
|
||||
<!--hk=_0-1-5-4o|leptos-dyn-child-start-->2<!\
|
||||
--hk=_0-1-5-4c|leptos-dyn-child-end-->!</span><button \
|
||||
id=\"_0-1-5-5\">+1</button></div><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-38|close--><!\
|
||||
--hk=_0-1-5-0c|leptos-counter-end--></div><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-49|close-->"
|
||||
);
|
||||
id=\"_0-1-5\">+1</button></div>"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -106,29 +88,13 @@ fn ssr_test_with_snake_case_components() {
|
||||
</div>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-101|open--><div id=\"_0-1\" \
|
||||
class=\"counters\"><!\
|
||||
--hk=_0-1-0o|leptos-snake-case-counter-start--><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-90|open--><div \
|
||||
id=\"_0-1-1\"><button id=\"_0-1-2\">-1</button><span \
|
||||
assert!(rendered.into_view(cx).render_to_string(cx).contains(
|
||||
"<div id=\"_0-1-1\"><button id=\"_0-1-2\">-1</button><span \
|
||||
id=\"_0-1-3\">Value: \
|
||||
<!--hk=_0-1-4o|leptos-dyn-child-start-->1<!\
|
||||
--hk=_0-1-4c|leptos-dyn-child-end-->!</span><button \
|
||||
id=\"_0-1-5\">+1</button></div><!--leptos-view|leptos-tests-ssr.\
|
||||
rs-90|close--><!--hk=_0-1-0c|leptos-snake-case-counter-end--><!\
|
||||
--hk=_0-1-5-0o|leptos-snake-case-counter-start--><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-90|open--><div \
|
||||
id=\"_0-1-5-1\"><button id=\"_0-1-5-2\">-1</button><span \
|
||||
id=\"_0-1-5-3\">Value: \
|
||||
<!--hk=_0-1-5-4o|leptos-dyn-child-start-->2<!\
|
||||
--hk=_0-1-5-4c|leptos-dyn-child-end-->!</span><button \
|
||||
id=\"_0-1-5-5\">+1</button></div><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-90|close--><!\
|
||||
--hk=_0-1-5-0c|leptos-snake-case-counter-end--></div><!\
|
||||
--leptos-view|leptos-tests-ssr.rs-101|close-->"
|
||||
);
|
||||
id=\"_0-1-5\">+1</button></div>"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -144,12 +110,10 @@ fn test_classes() {
|
||||
<div class="my big" class:a={move || value.get() > 10} class:red=true class:car={move || value.get() > 1}></div>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-142|open--><div id=\"_0-1\" \
|
||||
class=\"my big red \
|
||||
car\"></div><!--leptos-view|leptos-tests-ssr.rs-142|close-->"
|
||||
);
|
||||
assert!(rendered
|
||||
.into_view(cx)
|
||||
.render_to_string(cx)
|
||||
.contains("<div id=\"_0-1\" class=\"my big red car\"></div>"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -168,13 +132,10 @@ fn ssr_with_styles() {
|
||||
</div>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-164|open--><div id=\"_0-1\" \
|
||||
class=\" myclass\"><button id=\"_0-2\" class=\"btn \
|
||||
myclass\">-1</button></div><!--leptos-view|leptos-tests-ssr.\
|
||||
rs-164|close-->"
|
||||
);
|
||||
assert!(rendered.into_view(cx).render_to_string(cx).contains(
|
||||
"<div id=\"_0-1\" class=\" myclass\"><button id=\"_0-2\" \
|
||||
class=\"btn myclass\">-1</button></div>"
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -190,11 +151,9 @@ fn ssr_option() {
|
||||
<option/>
|
||||
};
|
||||
|
||||
assert_eq!(
|
||||
rendered.into_view(cx).render_to_string(cx),
|
||||
"<!--leptos-view|leptos-tests-ssr.rs-188|open--><option \
|
||||
id=\"_0-1\"></option><!--leptos-view|leptos-tests-ssr.\
|
||||
rs-188|close-->"
|
||||
);
|
||||
assert!(rendered
|
||||
.into_view(cx)
|
||||
.render_to_string(cx)
|
||||
.contains("<option id=\"_0-1\"></option>"));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -42,7 +42,7 @@ web-sys = { version = "0.3", optional = true, features = [
|
||||
] }
|
||||
cfg-if = "1"
|
||||
indexmap = "1"
|
||||
ouroboros = { version = "0.15.6", default-features = false }
|
||||
self_cell = "1.0.0"
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = { version = "0.4.0", features = ["html_reports"] }
|
||||
|
||||
@@ -188,7 +188,6 @@ impl Runtime {
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(clippy::await_holding_refcell_ref)] // not using this part of ouroboros
|
||||
pub(crate) fn mark_dirty(&self, node: NodeId) {
|
||||
//crate::macros::debug_warn!("marking {node:?} dirty");
|
||||
let mut nodes = self.nodes.borrow_mut();
|
||||
@@ -217,23 +216,24 @@ impl Runtime {
|
||||
* `Check` or `DirtyMarked`.
|
||||
*
|
||||
* Because `RefCell`, borrowing the iterators all at once is difficult,
|
||||
* so a self-referential struct is used instead. ouroboros produces safe
|
||||
* so a self-referential struct is used instead. self_cell produces safe
|
||||
* code, but it would not be recommended to use this outside of this
|
||||
* algorithm.
|
||||
*/
|
||||
|
||||
#[ouroboros::self_referencing]
|
||||
struct RefIter<'a> {
|
||||
set: std::cell::Ref<'a, FxIndexSet<NodeId>>,
|
||||
type Dependent<'a> = indexmap::set::Iter<'a, NodeId>;
|
||||
|
||||
// Boxes the iterator internally
|
||||
#[borrows(set)]
|
||||
#[covariant]
|
||||
iter: indexmap::set::Iter<'this, NodeId>,
|
||||
self_cell::self_cell! {
|
||||
struct RefIter<'a> {
|
||||
owner: std::cell::Ref<'a, FxIndexSet<NodeId>>,
|
||||
|
||||
#[not_covariant] // avoids extra codegen, harmless to mark it as such
|
||||
dependent: Dependent,
|
||||
}
|
||||
}
|
||||
|
||||
/// Due to the limitations of ouroboros, we cannot borrow the
|
||||
/// stack and iter simultaneously, or directly within the loop,
|
||||
/// Due to the limitations of self-referencing, we cannot borrow the
|
||||
/// stack and iter simultaneously within the closure or the loop,
|
||||
/// therefore this must be used to command the outside scope
|
||||
/// of what to do.
|
||||
enum IterResult<'a> {
|
||||
@@ -251,7 +251,7 @@ impl Runtime {
|
||||
}
|
||||
|
||||
while let Some(iter) = stack.last_mut() {
|
||||
let res = iter.with_iter_mut(|iter| {
|
||||
let res = iter.with_dependent_mut(|_, iter| {
|
||||
let Some(mut child) = iter.next().copied() else {
|
||||
return IterResult::Empty;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leptos_meta"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
edition = "2021"
|
||||
authors = ["Greg Johnston"]
|
||||
license = "MIT"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "leptos_router"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
edition = "2021"
|
||||
authors = ["Greg Johnston"]
|
||||
license = "MIT"
|
||||
|
||||
Reference in New Issue
Block a user