Skip to content

Commit

Permalink
fix: Resource::with() (pt. 3!) — closes #1751 without breaking #1742
Browse files Browse the repository at this point in the history
…or #1711
  • Loading branch information
gbj committed Sep 19, 2023
1 parent 2b59ae1 commit c65da28
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions leptos_reactive/src/resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1146,17 +1146,13 @@ where
let (was_loaded, v) =
self.value.try_with(|n| (n.is_some(), f(n))).ok()?;

if was_loaded {
self.handle_result(
location,
global_suspense_cx,
suspense_cx,
was_loaded.then_some(v),
true,
)
} else {
Some(v)
}
self.handle_result(
location,
global_suspense_cx,
suspense_cx,
Some(v),
!was_loaded,
)
}

fn handle_result<U>(
Expand Down

0 comments on commit c65da28

Please sign in to comment.