fix: cast to correct type on `Memo::try_with_untracked`

This commit is contained in:
Greg Johnston 2024-01-23 11:08:33 -05:00
parent c84c6ee8cd
commit 694e5f1cb3
1 changed files with 6 additions and 1 deletions

View File

@ -357,7 +357,12 @@ impl<T> SignalWithUntracked for Memo<T> {
#[inline] #[inline]
fn try_with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Option<O> { fn try_with_untracked<O>(&self, f: impl FnOnce(&T) -> O) -> Option<O> {
with_runtime(|runtime| { with_runtime(|runtime| {
self.id.try_with_no_subscription(runtime, |v: &T| f(v)).ok() self.id
.try_with_no_subscription(runtime, |v: &Option<T>| {
v.as_ref().map(f)
})
.ok()
.flatten()
}) })
.ok() .ok()
.flatten() .flatten()