From 03d6cf068777e5dbe65f4a13b4dee5087b89ec7b Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Thu, 24 Jul 2025 16:09:26 -0700 Subject: [PATCH 1/2] Flag our workaround for a Sycamore batching bug Add a reminder to remove the workaround once the bug is fixed. --- app-proto/src/components/add_remove.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/app-proto/src/components/add_remove.rs b/app-proto/src/components/add_remove.rs index ef5851c..a685482 100644 --- a/app-proto/src/components/add_remove.rs +++ b/app-proto/src/components/add_remove.rs @@ -18,6 +18,16 @@ pub fn AddRemove() -> View { // this call is batched to avoid redundant realizations. // it updates the element list and the regulator list, // which are both tracked by the realization effect + /* TO DO */ + // it would make more to do the batching inside + // `insert_element_default`, but that will have to wait + // until Sycamore handles nested batches correctly. + // + // https://github.com/sycamore-rs/sycamore/issues/802 + // + // the nested batch issue is relevant here because the + // assembly loaders in the test assembly chooser use + // `insert_element_default` within larger batches state.assembly.insert_element_default::(); }); } From 2bae8d3df9de198deeb148040ad2c39d35c2b7d3 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Thu, 24 Jul 2025 16:32:18 -0700 Subject: [PATCH 2/2] Prevent unused imports for engine debug output In the process, switch from the `web-sys` crate's `console::log_1` function to Sycamore's more flexible `console_log` macro. The latter works both inside and outside the browser, so we can use it without checking whether we're compiling to WebAssembly. --- app-proto/src/engine.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/app-proto/src/engine.rs b/app-proto/src/engine.rs index 9f4c688..8b5d982 100644 --- a/app-proto/src/engine.rs +++ b/app-proto/src/engine.rs @@ -1,7 +1,10 @@ use lazy_static::lazy_static; use nalgebra::{Const, DMatrix, DVector, DVectorView, Dyn, SymmetricEigen}; use std::fmt::{Display, Error, Formatter}; -use web_sys::{console, wasm_bindgen::JsValue}; /* DEBUG */ + +/* DEBUG */ +#[cfg(not(feature = "dev"))] +use sycamore::prelude::console_log; // --- elements --- @@ -167,10 +170,8 @@ impl ConfigSubspace { /* DEBUG */ // print the eigenvalues - #[cfg(all(target_family = "wasm", target_os = "unknown"))] - console::log_1(&JsValue::from( - format!("Eigenvalues used to find kernel:{}", eig.eigenvalues) - )); + #[cfg(not(feature = "dev"))] + console_log!("Eigenvalues used to find kernel:{}", eig.eigenvalues); // express the basis in the standard coordinates let basis_std = proj_to_std * &basis_proj;