Skip to content

Commit

Permalink
change: only run create_local_resource in the browser
Browse files Browse the repository at this point in the history
  • Loading branch information
gbj committed Sep 23, 2023
1 parent 18eeee8 commit 4397e35
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions leptos_reactive/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,9 @@ where
/// value of the `source` changes, a new [`Future`] will be created and run.
///
/// Unlike [`create_resource()`], this [`Future`] is always run on the local system
/// and therefore it's result type does not need to be [`Serializable`].
/// and therefore its result type does not need to be [`Serializable`].
///
/// Local resources do not load on the server, only in the client’s browser.
///
/// ```
/// # use leptos_reactive::*;
Expand Down Expand Up @@ -303,6 +305,8 @@ where
/// Unlike [`create_resource_with_initial_value()`], this [`Future`] will always run
/// on the local system and therefore its output type does not need to be
/// [`Serializable`].
///
/// Local resources do not load on the server, only in the client’s browser.
#[cfg_attr(
any(debug_assertions, feature="ssr"),
instrument(
Expand Down Expand Up @@ -358,10 +362,10 @@ where
})
.expect("tried to create a Resource in a runtime that has been disposed.");

create_isomorphic_effect({
// This is a local resource, so we're always going to handle it on the
// client
create_render_effect({
let r = Rc::clone(&r);
// This is a local resource, so we're always going to handle it on the
// client
move |_| r.load(false)
});

Expand Down

0 comments on commit 4397e35

Please sign in to comment.