Cleanup in global signals

This commit is contained in:
Jonathan Kelley committed 2024-01-19 15:50:00 -08:00
1 parent 60f5697e8e
commit c1be911dd7
1 file changed
+5 -12
+5 -12
View File
@@ -1,3 +1,7 @@
use dioxus_core::prelude::{
provide_root_context, try_consume_context, IntoAttributeValue, ScopeId,
};
use generational_box::{GenerationalRef, GenerationalRefMut};
use std::{
any::Any,
cell::{Ref, RefCell, RefMut},
@@ -7,12 +11,6 @@ use std::{
rc::Rc,
};
use dioxus_core::{
prelude::{provide_context, provide_root_context, try_consume_context, IntoAttributeValue},
ScopeId,
};
use generational_box::{GenerationalRef, GenerationalRefMut};
use crate::{MappedSignal, ReadOnlySignal, Signal, Write};
/// A signal that can be accessed from anywhere in the application and created in a static
@@ -50,12 +48,7 @@ impl<T: 'static> GlobalSignal<T> {
let read = context.signal.borrow();
match read.get(&key) {
Some(signal) => {
let signal = signal.downcast_ref::<Signal<T>>().unwrap();
dbg!(signal.id());
*signal
}
Some(signal) => signal.downcast_ref::<Signal<T>>().unwrap().clone(),
None => {
drop(read);