fix release builds

This commit is contained in:
Evan Almloff committed 2023-08-21 14:28:45 -05:00
1 parent df85b25548
commit f09a2e2280
4 files changed
+24 -20

No files matched your search

+9 -3
View File
@@ -1,4 +1,3 @@
use std::panic::Location;
use std::rc::Rc;
use dioxus_core::prelude::{
@@ -85,11 +84,18 @@ impl<T: 'static> CopyValue<T> {
}
}
pub(crate) fn new_with_caller(value: T, caller: &'static Location<'static>) -> Self {
pub(crate) fn new_with_caller(
value: T,
#[cfg(debug_assertions)] caller: &'static std::panic::Location<'static>,
) -> Self {
let owner = current_owner();
Self {
value: owner.insert_with_caller(value, caller),
value: owner.insert_with_caller(
value,
#[cfg(debug_assertions)]
caller,
),
origin_scope: current_scope_id().expect("in a virtual dom"),
}
}
+2 -3
View File
@@ -1,7 +1,6 @@
use std::{
cell::RefCell,
ops::{Deref, DerefMut},
panic::Location,
rc::Rc,
sync::Arc,
};
@@ -48,7 +47,7 @@ use crate::{CopyValue, Effect};
#[track_caller]
pub fn use_signal<T: 'static>(cx: &ScopeState, f: impl FnOnce() -> T) -> Signal<T> {
#[cfg(debug_assertions)]
let caller = Location::caller();
let caller = std::panic::Location::caller();
*cx.use_hook(|| {
Signal::new_with_caller(
@@ -161,7 +160,7 @@ impl<T: 'static> Signal<T> {
/// Creates a new Signal. Signals are a Copy state management solution with automatic dependency tracking.
fn new_with_caller(
value: T,
#[cfg(debug_assertions)] caller: &'static Location<'static>,
#[cfg(debug_assertions)] caller: &'static std::panic::Location<'static>,
) -> Self {
Self {
inner: CopyValue::new_with_caller(