fix infinite recursion in reactive context

This commit is contained in:
Evan Almloff committed 2024-02-05 07:23:32 -06:00
1 parent 26378631e0
commit 26e4651e9f
2 files changed
+7 -4

No files matched your search

+5 -2
View File
@@ -19,7 +19,7 @@ pub struct ReactiveContext {
}
thread_local! {
static CURRENT: RefCell<Vec<ReactiveContext>> = RefCell::new(vec![]);
static CURRENT: RefCell<Vec<ReactiveContext>> = const { RefCell::new(vec![]) };
}
impl ReactiveContext {
@@ -42,7 +42,10 @@ impl ReactiveContext {
};
let mut self_ = Self {
inner: CopyValue::new_maybe_sync(inner),
inner: CopyValue::new_maybe_sync_in_scope(
inner,
scope.or_else(current_scope_id).unwrap(),
),
};
self_.inner.write().self_ = Some(self_);