diff --git a/leptos_dom/.cargo/config.toml b/leptos_dom/.cargo/config.toml
index 1497e92a4..be97324a4 100644
--- a/leptos_dom/.cargo/config.toml
+++ b/leptos_dom/.cargo/config.toml
@@ -1,2 +1,2 @@
-[build]
+# [build]
# target = "wasm32-unknown-unknown"
\ No newline at end of file
diff --git a/leptos_dom/examples/test-bench/Cargo.toml b/leptos_dom/examples/test-bench/Cargo.toml
index 3292065f1..4807566c7 100644
--- a/leptos_dom/examples/test-bench/Cargo.toml
+++ b/leptos_dom/examples/test-bench/Cargo.toml
@@ -9,5 +9,6 @@ gloo = { version = "0.8", features = ["futures"] }
leptos = { path = "../../../leptos", features = ["tracing"] }
tracing = "0.1"
tracing-subscriber = "0.3"
+tracing-subscriber-wasm = "0.1"
[workspace]
diff --git a/leptos_dom/examples/test-bench/src/main.rs b/leptos_dom/examples/test-bench/src/main.rs
index c06183070..4e5f4f29e 100644
--- a/leptos_dom/examples/test-bench/src/main.rs
+++ b/leptos_dom/examples/test-bench/src/main.rs
@@ -1,102 +1,142 @@
+#![feature(iter_intersperse)]
#![allow(warnings)]
#[macro_use]
extern crate tracing;
-mod utils;
-
use leptos::*;
use tracing::field::debug;
use tracing_subscriber::util::SubscriberInitExt;
fn main() {
- console_error_panic_hook::set_once();
+ console_error_panic_hook::set_once();
- tracing_subscriber::fmt()
- .with_max_level(tracing::Level::TRACE)
- .without_time()
- .with_file(true)
- .with_line_number(true)
- .with_target(false)
- .with_writer(utils::MakeConsoleWriter)
- .with_ansi(false)
- .pretty()
- .finish()
- .init();
+ tracing_subscriber::fmt()
+ .with_max_level(tracing::Level::TRACE)
+ .without_time()
+ .with_file(true)
+ .with_line_number(true)
+ .with_target(false)
+ .with_writer(tracing_subscriber_wasm::MakeConsoleWriter::default())
+ .with_ansi(false)
+ .pretty()
+ .finish()
+ .init();
- mount_to_body(view_fn);
+ mount_to_body(view_fn);
}
+// fn view_fn(cx: Scope) -> impl IntoView {
+// view! { cx,
+//
"Passing Tests"
+//
+// /* These work! */
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// "Broken Tests"
+//
+//
+//
+//
+//
+//
+//
+//
+//
+//
+// }
+// }
+
+// #[component]
+// fn Test(cx: Scope, from: From, to: To) -> impl IntoView
+// where
+// From: IntoIterator- ,
+// To: IntoIterator
- ,
+// {
+// let from = from.into_iter().collect::>();
+// let to = to.into_iter().collect::>();
+
+// let (list, set_list) = create_signal(cx, from.clone());
+// request_animation_frame({
+// let to = to.clone();
+// move || {
+// set_list(to);
+// }
+// });
+
+// view! { cx,
+//
+// "from: [" {move ||
+// from
+// .iter()
+// .map(ToString::to_string)
+// .intersperse(", ".to_string())
+// .collect::()
+// } "]"
+//
+// "to: [" {move ||
+// to
+// .iter()
+// .map(ToString::to_string)
+// .intersperse(", ".to_string())
+// .collect::()
+// } "]"
+//
+// "result: ["
+// {i} ", " }
+// }
+// /> "]"
+// /*
+// "Pre | "
+// {i} }
+// }
+// />
+// " | Post"
+//
*/
+//
+// }
+// }
+
fn view_fn(cx: Scope) -> impl IntoView {
- let view = view! { cx,
-
- }
- .into_view(cx);
+ let (should_show_a, sett_should_show_a) = create_signal(cx, true);
- let (a, set_a) = create_signal(cx, view.clone());
- let (b, set_b) = create_signal(cx, view);
+ let a = vec![1, 2, 3, 4];
+ let b = vec![1, 2, 3];
- let (is_a, set_is_a) = create_signal(cx, true);
+ view! { cx,
+
- let handle_toggle = move |_| {
- trace!("toggling");
- if is_a() {
- set_b(a());
-
- set_is_a(false);
- } else {
- set_a(a());
-
- set_is_a(true);
+ {i} }
+ />
}
- };
-
- let a_tag = view! { cx, };
-
- view! { cx,
- <>
-
-
-
-
-
-
-
- >
- }
-}
-
-#[component]
-fn A(cx: Scope, child: Signal) -> impl IntoView {
- move || child()
-}
-
-#[component]
-fn Example(cx: Scope) -> impl IntoView {
- trace!("rendering ");
-
- let (value, set_value) = create_signal(cx, 10);
-
- let memo = create_memo(cx, move |_| value() * 2);
- let derived = Signal::derive(cx, move || value() * 3);
-
- create_effect(cx, move |_| {
- trace!("logging value of derived..., {}", derived.get());
- });
-
- set_timeout(
- move || set_value.update(|v| *v += 1),
- std::time::Duration::from_millis(50),
- );
-
- view! { cx,
- "Example"
-
- }
}
diff --git a/leptos_dom/examples/test-bench/src/utils.rs b/leptos_dom/examples/test-bench/src/utils.rs
deleted file mode 100644
index 2ed7c3c13..000000000
--- a/leptos_dom/examples/test-bench/src/utils.rs
+++ /dev/null
@@ -1,47 +0,0 @@
-pub struct MakeConsoleWriter;
-use std::io::{self, Write};
-use tracing_subscriber::fmt::MakeWriter;
-
-impl<'a> MakeWriter<'a> for MakeConsoleWriter {
- type Writer = ConsoleWriter;
-
- fn make_writer(&'a self) -> Self::Writer {
- unimplemented!("use make_writer_for instead");
- }
-
- fn make_writer_for(&'a self, meta: &tracing::Metadata<'_>) -> Self::Writer {
- ConsoleWriter(*meta.level(), Vec::with_capacity(256))
- }
-}
-
-pub struct ConsoleWriter(tracing::Level, Vec);
-
-impl io::Write for ConsoleWriter {
- fn write(&mut self, buf: &[u8]) -> io::Result {
- self.1.write(buf)
- }
-
- fn flush(&mut self) -> io::Result<()> {
- use gloo::console;
- use tracing::Level;
-
- let data = String::from_utf8(self.1.to_owned())
- .map_err(|_| io::Error::new(io::ErrorKind::InvalidData, "data not UTF-8"))?;
-
- match self.0 {
- Level::TRACE => console::debug!(&data),
- Level::DEBUG => console::debug!(&data),
- Level::INFO => console::log!(&data),
- Level::WARN => console::warn!(&data),
- Level::ERROR => console::error!(&data),
- }
-
- Ok(())
- }
-}
-
-impl Drop for ConsoleWriter {
- fn drop(&mut self) {
- let _ = self.flush();
- }
-}
diff --git a/leptos_dom/src/components/dyn_child.rs b/leptos_dom/src/components/dyn_child.rs
index 6ba74b0ca..afca11367 100644
--- a/leptos_dom/src/components/dyn_child.rs
+++ b/leptos_dom/src/components/dyn_child.rs
@@ -402,7 +402,7 @@ cfg_if! {
if #[cfg(all(target_arch = "wasm32", feature = "web"))] {
use web_sys::Node;
- trait NonViewMarkerSibling {
+ pub(crate) trait NonViewMarkerSibling {
fn next_non_view_marker_sibling(&self) -> Option;
fn previous_non_view_marker_sibling(&self) -> Option;
diff --git a/leptos_dom/src/components/each.rs b/leptos_dom/src/components/each.rs
index 4486dc63f..a137a388d 100644
--- a/leptos_dom/src/components/each.rs
+++ b/leptos_dom/src/components/each.rs
@@ -1,45 +1,48 @@
+#[cfg(not(all(target_arch = "wasm32", feature = "web")))]
+use crate::hydration::HydrationKey;
use crate::{hydration::HydrationCtx, Comment, CoreComponent, IntoView, View};
-use cfg_if::cfg_if;
-cfg_if! {
- if #[cfg(all(target_arch = "wasm32", feature = "web"))] {
- use crate::{mount_child, prepare_to_move, MountKind, Mountable, RANGE};
- use once_cell::unsync::OnceCell;
- use leptos_reactive::create_effect;
- use rustc_hash::FxHasher;
- use std::hash::BuildHasherDefault;
- use wasm_bindgen::JsCast;
- use drain_filter_polyfill::VecExt as VecDrainFilterExt;
-
- type FxIndexSet = indexmap::IndexSet>;
-
- #[cfg(all(target_arch = "wasm32", feature = "web"))]
- trait VecExt {
- fn get_next_closest_mounted_sibling(
- &self,
- start_at: usize,
- or: web_sys::Node,
- ) -> web_sys::Node;
- }
-
- #[cfg(all(target_arch = "wasm32", feature = "web"))]
- impl VecExt for Vec