fix formatting

This commit is contained in:
Evan Almloff committed 2024-02-14 12:13:54 -06:00
1 parent 78ef453888
commit 05a6dda89c
8 files changed
+15 -15

No files matched your search

+2 -4
View File
@@ -86,11 +86,9 @@ fn current_owner<S: Storage<T>, T>() -> Owner<S> {
}
// Otherwise get the owner from the current reactive context.
match ReactiveContext::current(){
match ReactiveContext::current() {
Some(current_reactive_context) => owner_in_scope(current_reactive_context.origin_scope()),
None => {
owner_in_scope(current_scope_id().expect("in a virtual dom"))
}
None => owner_in_scope(current_scope_id().expect("in a virtual dom")),
}
}
+5 -3
View File
@@ -1,5 +1,5 @@
use dioxus_core::prelude::{
current_scope_id, has_context, provide_context, schedule_update_any, ScopeId
current_scope_id, has_context, provide_context, schedule_update_any, ScopeId,
};
use generational_box::SyncStorage;
use rustc_hash::FxHashSet;
@@ -77,7 +77,7 @@ impl ReactiveContext {
}
// If we're rendering, then try and use the reactive context attached to this component
if !dioxus_core::vdom_is_rendering(){
if !dioxus_core::vdom_is_rendering() {
return None;
}
if let Some(cx) = has_context() {
@@ -85,7 +85,9 @@ impl ReactiveContext {
}
// Otherwise, create a new context at the current scope
Some(provide_context(ReactiveContext::new_for_scope(current_scope_id())))
Some(provide_context(ReactiveContext::new_for_scope(
current_scope_id(),
)))
}
/// Run this function in the context of this reactive context
+1 -1
View File
@@ -201,7 +201,7 @@ impl<T, S: Storage<SignalData<T>>> Readable for Signal<T, S> {
fn try_read(&self) -> Result<ReadableRef<Self>, generational_box::BorrowError> {
let inner = self.inner.try_read()?;
if let Some(reactive_context) = ReactiveContext::current(){
if let Some(reactive_context) = ReactiveContext::current() {
inner.subscribers.lock().unwrap().insert(reactive_context);
}