Fix memorization for the fragment component (#2360)
This commit is contained in:
1 parent
47c87568e1
commit
fc2b441ee1
2 files changed
+10
-4
No files matched your search
@@ -344,7 +344,8 @@ impl Properties for ErrorBoundaryProps {
|
|||||||
fn builder() -> Self::Builder {
|
fn builder() -> Self::Builder {
|
||||||
ErrorBoundaryProps::builder()
|
ErrorBoundaryProps::builder()
|
||||||
}
|
}
|
||||||
fn memoize(&mut self, _: &Self) -> bool {
|
fn memoize(&mut self, other: &Self) -> bool {
|
||||||
|
*self = other.clone();
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ use crate::innerlude::*;
|
|||||||
/// You want to use this free-function when your fragment needs a key and simply returning multiple nodes from rsx! won't cut it.
|
/// You want to use this free-function when your fragment needs a key and simply returning multiple nodes from rsx! won't cut it.
|
||||||
#[allow(non_upper_case_globals, non_snake_case)]
|
#[allow(non_upper_case_globals, non_snake_case)]
|
||||||
pub fn Fragment(cx: FragmentProps) -> Element {
|
pub fn Fragment(cx: FragmentProps) -> Element {
|
||||||
cx.0.clone()
|
cx.0
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, PartialEq)]
|
#[derive(Clone, PartialEq)]
|
||||||
@@ -90,7 +90,12 @@ impl Properties for FragmentProps {
|
|||||||
fn builder() -> Self::Builder {
|
fn builder() -> Self::Builder {
|
||||||
FragmentBuilder(None)
|
FragmentBuilder(None)
|
||||||
}
|
}
|
||||||
fn memoize(&mut self, _other: &Self) -> bool {
|
fn memoize(&mut self, new: &Self) -> bool {
|
||||||
false
|
let equal = self == new;
|
||||||
|
if !equal {
|
||||||
|
let new_clone = new.clone();
|
||||||
|
self.0 = new_clone.0;
|
||||||
|
}
|
||||||
|
equal
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user