feat: props memoization is more powerful
This commit solves the memoization , properly memoizing properties that don't have any generic parameters. This is a rough heuristic to prevent non-static lifetimes from creeping into props and breaking our minual lifetime management. Props that have a generic parameter are opted-out of the `partialeq` requirement and props *without* lifetimes must implement partialeq. We're going to leave manual disabling of memoization for future work.
This commit is contained in:
1 parent
7102fe5f98
commit
73047fe956
37 files changed
+877
-977
No files matched your search
@@ -1,3 +1,4 @@
|
||||
use dioxus_core as dioxus;
|
||||
use dioxus_core::{events::on::MouseEvent, prelude::*};
|
||||
use dioxus_web::WebsysRenderer;
|
||||
|
||||
@@ -14,7 +15,7 @@ fn main() {
|
||||
static Example: FC<()> = |ctx| {
|
||||
let (event, set_event) = use_state(&ctx, || None);
|
||||
|
||||
let handler = move |evt: MouseEvent| {
|
||||
let handler = move |evt| {
|
||||
set_event(Some(evt));
|
||||
};
|
||||
|
||||
@@ -42,17 +43,15 @@ static Example: FC<()> = |ctx| {
|
||||
})
|
||||
};
|
||||
|
||||
|
||||
#[derive(Debug, PartialEq, Props)]
|
||||
struct ExampleProps {
|
||||
name: String
|
||||
name: String,
|
||||
}
|
||||
|
||||
static Example2: FC<ExampleProps> = |ctx| {
|
||||
ctx.render(rsx!{
|
||||
ctx.render(rsx! {
|
||||
div {
|
||||
h1 {"hello {ctx.name}"}
|
||||
}
|
||||
})
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user