mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
This commit is contained in:
parent
54e8a536c4
commit
20e5db22b8
8 changed files with 27 additions and 21 deletions
|
@ -4,7 +4,8 @@ use leptos::component;
|
|||
use leptos_dom::{helpers::TimeoutHandle, IntoView};
|
||||
use leptos_macro::view;
|
||||
use leptos_reactive::{
|
||||
create_effect, on_cleanup, signal_prelude::*, store_value, StoredValue,
|
||||
create_render_effect, on_cleanup, signal_prelude::*, store_value,
|
||||
StoredValue,
|
||||
};
|
||||
|
||||
/// A component that will show its children when the `when` condition is `true`.
|
||||
|
@ -70,7 +71,7 @@ pub fn AnimatedShow(
|
|||
});
|
||||
let show = create_rw_signal(when.get_untracked());
|
||||
|
||||
create_effect(move |_| {
|
||||
create_render_effect(move |_| {
|
||||
if when.get() {
|
||||
// clear any possibly active timer
|
||||
if let Some(h) = handle.get_value() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
use crate::{
|
||||
create_effect, diagnostics::AccessDiagnostics, node::NodeId, on_cleanup,
|
||||
with_runtime, AnyComputation, Runtime, SignalDispose, SignalGet,
|
||||
SignalGetUntracked, SignalStream, SignalWith, SignalWithUntracked,
|
||||
create_isomorphic_effect, diagnostics::AccessDiagnostics, node::NodeId,
|
||||
on_cleanup, with_runtime, AnyComputation, Runtime, SignalDispose,
|
||||
SignalGet, SignalGetUntracked, SignalStream, SignalWith,
|
||||
SignalWithUntracked,
|
||||
};
|
||||
use std::{any::Any, cell::RefCell, fmt, marker::PhantomData, rc::Rc};
|
||||
|
||||
|
@ -500,7 +501,7 @@ impl<T: Clone> SignalStream<T> for Memo<T> {
|
|||
|
||||
let this = *self;
|
||||
|
||||
create_effect(move |_| {
|
||||
create_isomorphic_effect(move |_| {
|
||||
let _ = tx.unbounded_send(this.get());
|
||||
});
|
||||
|
||||
|
|
|
@ -3,8 +3,8 @@ use crate::SharedContext;
|
|||
#[cfg(debug_assertions)]
|
||||
use crate::SpecialNonReactiveZone;
|
||||
use crate::{
|
||||
create_effect, create_isomorphic_effect, create_memo, create_signal,
|
||||
queue_microtask, runtime::with_runtime, serialization::Serializable,
|
||||
create_isomorphic_effect, create_memo, create_signal, queue_microtask,
|
||||
runtime::with_runtime, serialization::Serializable,
|
||||
signal_prelude::format_signal_warning, spawn::spawn_local, use_context,
|
||||
GlobalSuspenseContext, Memo, ReadSignal, ScopeProperty, Signal,
|
||||
SignalDispose, SignalGet, SignalGetUntracked, SignalSet, SignalUpdate,
|
||||
|
@ -259,7 +259,9 @@ where
|
|||
/// }
|
||||
///
|
||||
/// // create the resource; it will run but not be serialized
|
||||
/// # if cfg!(not(any(feature = "csr", feature = "hydrate"))) {
|
||||
/// # // `csr`, `hydrate`, and `ssr` all have issues here
|
||||
/// # // because we're not running in a browser or in Tokio. Let's just ignore it.
|
||||
/// # if false {
|
||||
/// let result =
|
||||
/// create_local_resource(move || (), |_| setup_complicated_struct());
|
||||
/// # }
|
||||
|
@ -351,7 +353,7 @@ where
|
|||
})
|
||||
.expect("tried to create a Resource in a runtime that has been disposed.");
|
||||
|
||||
create_effect({
|
||||
create_isomorphic_effect({
|
||||
let r = Rc::clone(&r);
|
||||
// This is a local resource, so we're always going to handle it on the
|
||||
// client
|
||||
|
@ -1001,7 +1003,9 @@ where
|
|||
/// }
|
||||
///
|
||||
/// // create the resource; it will run but not be serialized
|
||||
/// # if cfg!(not(any(feature = "csr", feature = "hydrate"))) {
|
||||
/// # // `csr`, `hydrate`, and `ssr` all have issues here
|
||||
/// # // because we're not running in a browser or in Tokio. Let's just ignore it.
|
||||
/// # if false {
|
||||
/// let result =
|
||||
/// create_local_resource(move || (), |_| setup_complicated_struct());
|
||||
/// # }
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
console_warn, create_effect, diagnostics, diagnostics::*,
|
||||
console_warn, create_isomorphic_effect, diagnostics, diagnostics::*,
|
||||
macros::debug_warn, node::NodeId, on_cleanup, runtime::with_runtime,
|
||||
Runtime,
|
||||
};
|
||||
|
@ -702,7 +702,7 @@ impl<T: Clone> SignalStream<T> for ReadSignal<T> {
|
|||
|
||||
let this = *self;
|
||||
|
||||
create_effect(move |_| {
|
||||
create_isomorphic_effect(move |_| {
|
||||
let _ = tx.unbounded_send(this.get());
|
||||
});
|
||||
|
||||
|
@ -1775,7 +1775,7 @@ impl<T: Clone> SignalStream<T> for RwSignal<T> {
|
|||
|
||||
let this = *self;
|
||||
|
||||
create_effect(move |_| {
|
||||
create_isomorphic_effect(move |_| {
|
||||
let _ = tx.unbounded_send(this.get());
|
||||
});
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
create_effect, on_cleanup, runtime::untrack, store_value, Memo, ReadSignal,
|
||||
RwSignal, SignalGet, SignalGetUntracked, SignalStream, SignalWith,
|
||||
SignalWithUntracked, StoredValue,
|
||||
create_isomorphic_effect, on_cleanup, runtime::untrack, store_value, Memo,
|
||||
ReadSignal, RwSignal, SignalGet, SignalGetUntracked, SignalStream,
|
||||
SignalWith, SignalWithUntracked, StoredValue,
|
||||
};
|
||||
|
||||
/// Helper trait for converting `Fn() -> T` closures into
|
||||
|
@ -332,7 +332,7 @@ impl<T: Clone> SignalStream<T> for Signal<T> {
|
|||
|
||||
on_cleanup(move || close_channel.close_channel());
|
||||
|
||||
create_effect(move |_| {
|
||||
create_isomorphic_effect(move |_| {
|
||||
let _ = s.try_with_value(|t| tx.unbounded_send(t()));
|
||||
});
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ pub fn Outlet() -> impl IntoView {
|
|||
|
||||
let (current_view, set_current_view) = create_signal(None);
|
||||
|
||||
create_effect({
|
||||
create_render_effect({
|
||||
move |prev| {
|
||||
let outlet = outlet.get();
|
||||
let is_fallback =
|
||||
|
|
|
@ -31,7 +31,7 @@ pub fn RoutingProgress(
|
|||
let (is_showing, set_is_showing) = create_signal(false);
|
||||
let (progress, set_progress) = create_signal(0.0);
|
||||
|
||||
create_effect(move |prev: Option<Option<IntervalHandle>>| {
|
||||
create_render_effect(move |prev: Option<Option<IntervalHandle>>| {
|
||||
if is_routing.get() && !is_showing.get() {
|
||||
set_is_showing.set(true);
|
||||
set_interval_with_handle(
|
||||
|
|
|
@ -504,7 +504,7 @@ fn root_route(
|
|||
|
||||
let (current_view, set_current_view) = create_signal(None);
|
||||
|
||||
create_effect(move |prev| {
|
||||
create_render_effect(move |prev| {
|
||||
let root = root_view.get();
|
||||
let is_fallback = !global_suspense.with_inner(|c| c.ready().get());
|
||||
if prev.is_none() {
|
||||
|
|
Loading…
Reference in a new issue