Skip to content

Commit

Permalink
fix: Use signal outside of reactive context
Browse files Browse the repository at this point in the history
  • Loading branch information
uncomputable committed Nov 17, 2024
1 parent 636e723 commit ccdf0b8
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/components/program_window/program_tab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit ccdf0b8

Please sign in to comment.