diff options
Diffstat (limited to 'src/state_store.rs')
-rw-r--r-- | src/state_store.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/state_store.rs b/src/state_store.rs index 8d80b3f..ac90e40 100644 --- a/src/state_store.rs +++ b/src/state_store.rs @@ -1,6 +1,7 @@ use std::{collections::HashMap, ops::{Deref, DerefMut}, sync::{Arc, RwLock}}; use leptos::prelude::*; +use tracing::debug; // TODO: get rid of this // V has to be an arc signal @@ -105,7 +106,7 @@ impl<K, V, S> Clone for StateStore<K, V, S> { } } -impl<K: Eq + std::hash::Hash + Clone, V: Clone> StateStore<K, V> +impl<K: Eq + std::hash::Hash + Clone + std::fmt::Debug, V: Clone + std::fmt::Debug> StateStore<K, V> where K: Send + Sync + 'static, V: Send + Sync + 'static, @@ -114,7 +115,9 @@ where { let store = self.inner.try_get_value().unwrap(); let mut store = store.store.write().unwrap(); + debug!("store state: {:?}", store); if let Some((v, count)) = store.get_mut(&key) { + debug!("updating old value already in store"); v.set(value); *count += 1; StateListener { @@ -127,6 +130,7 @@ where } else { let v = ArcRwSignal::new(value); store.insert(key.clone(), (v.clone(), 1)); + debug!("inserting new value: {:?}", store); StateListener { value: v.into(), cleaner: StateCleaner { |