From ccdf0b871975af6da145946313a424823dd241ca Mon Sep 17 00:00:00 2001 From: Christian Lewe Date: Sun, 17 Nov 2024 03:04:57 +0100 Subject: [PATCH] fix: Use signal outside of reactive context --- src/components/program_window/program_tab.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/program_window/program_tab.rs b/src/components/program_window/program_tab.rs index bad49a8..f60d59f 100644 --- a/src/components/program_window/program_tab.rs +++ b/src/components/program_window/program_tab.rs @@ -4,8 +4,8 @@ use hex_conservative::DisplayHex; use itertools::Itertools; use leptos::{ component, create_node_ref, create_rw_signal, ev, event_target_value, html, spawn_local, - use_context, view, with, IntoView, NodeRef, RwSignal, Signal, SignalGetUntracked, SignalSet, - SignalUpdate, SignalWith, + use_context, view, IntoView, NodeRef, RwSignal, Signal, SignalGetUntracked, SignalSet, + SignalUpdate, SignalWith, SignalWithUntracked, }; use simfony::elements::secp256k1_zkp as secp256k1; use simfony::parse::ParseFromStr; @@ -60,13 +60,14 @@ fn main() {{ } pub fn update_on_read(self) { - let text = self.text; - let cached_text = self.cached_text; - let needs_update = with!(|text, cached_text| { text != cached_text }); + let needs_update = self.text.with_untracked(|text| { + self.cached_text + .with_untracked(|cached_text| text != cached_text) + }); if !needs_update { return; } - with!(|text| { + self.text.with_untracked(|text| { self.cached_text.set(text.clone()); let compiled = CompiledProgram::new(text); self.lazy_cmr