Fix effect stack issue
This commit is contained in:
6 files changed
+38
-31
No files matched your search
@@ -27,7 +27,10 @@ pub fn try_consume_context<T: 'static + Clone>() -> Option<T> {
|
||||
pub fn consume_context<T: 'static + Clone>() -> T {
|
||||
with_current_scope(|cx| cx.consume_context::<T>())
|
||||
.flatten()
|
||||
.unwrap_or_else(|| panic!("Could not find context {}", std::any::type_name::<T>(),))
|
||||
.expect(&format!(
|
||||
"Could not find context {}",
|
||||
std::any::type_name::<T>(),
|
||||
))
|
||||
}
|
||||
|
||||
/// Consume context from the current scope
|
||||
|
||||
Reference in new issue
Block a user