mirror of
https://github.com/leptos-rs/leptos
synced 2024-11-10 06:44:17 +00:00
perf: only rebuild keys when we've touched the list itself, not when we edit a row
This commit is contained in:
parent
5ab865e89d
commit
3310e7766b
1 changed files with 12 additions and 16 deletions
|
@ -95,13 +95,7 @@ where
|
||||||
{
|
{
|
||||||
type Value = T;
|
type Value = T;
|
||||||
type Reader = Mapped<Inner::Reader, T>;
|
type Reader = Mapped<Inner::Reader, T>;
|
||||||
type Writer = KeyedSubfieldWriteGuard<
|
type Writer = MappedMut<WriteGuard<ArcTrigger, Inner::Writer>, T>;
|
||||||
Inner,
|
|
||||||
Prev,
|
|
||||||
K,
|
|
||||||
T,
|
|
||||||
MappedMut<WriteGuard<ArcTrigger, Inner::Writer>, T>,
|
|
||||||
>;
|
|
||||||
type UntrackedWriter =
|
type UntrackedWriter =
|
||||||
MappedMut<WriteGuard<ArcTrigger, Inner::UntrackedWriter>, T>;
|
MappedMut<WriteGuard<ArcTrigger, Inner::UntrackedWriter>, T>;
|
||||||
|
|
||||||
|
@ -125,11 +119,7 @@ where
|
||||||
let path = self.path().into_iter().collect::<StorePath>();
|
let path = self.path().into_iter().collect::<StorePath>();
|
||||||
let trigger = self.get_trigger(path.clone());
|
let trigger = self.get_trigger(path.clone());
|
||||||
let guard = WriteGuard::new(trigger, self.inner.writer()?);
|
let guard = WriteGuard::new(trigger, self.inner.writer()?);
|
||||||
let guard = MappedMut::new(guard, self.read, self.write);
|
Some(MappedMut::new(guard, self.read, self.write))
|
||||||
Some(KeyedSubfieldWriteGuard {
|
|
||||||
inner: self.clone(),
|
|
||||||
guard: Some(guard),
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn untracked_writer(&self) -> Option<Self::UntrackedWriter> {
|
fn untracked_writer(&self) -> Option<Self::UntrackedWriter> {
|
||||||
|
@ -336,15 +326,21 @@ where
|
||||||
type Value = T;
|
type Value = T;
|
||||||
|
|
||||||
fn try_write(&self) -> Option<impl UntrackableGuard<Target = Self::Value>> {
|
fn try_write(&self) -> Option<impl UntrackableGuard<Target = Self::Value>> {
|
||||||
self.writer()
|
let guard = self.writer()?;
|
||||||
|
Some(KeyedSubfieldWriteGuard {
|
||||||
|
inner: self.clone(),
|
||||||
|
guard: Some(guard),
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_write_untracked(
|
fn try_write_untracked(
|
||||||
&self,
|
&self,
|
||||||
) -> Option<impl DerefMut<Target = Self::Value>> {
|
) -> Option<impl DerefMut<Target = Self::Value>> {
|
||||||
self.writer().map(|mut writer| {
|
let mut guard = self.writer()?;
|
||||||
writer.untrack();
|
guard.untrack();
|
||||||
writer
|
Some(KeyedSubfieldWriteGuard {
|
||||||
|
inner: self.clone(),
|
||||||
|
guard: Some(guard),
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue