Skip to content

Commit ba9e1db

Browse files
committed
fix: messed up how lifetimes worked, need to render once per component
1 parent 0e9d5fc commit ba9e1db

33 files changed

+326
-187
lines changed

examples/borrowed.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ fn main() {
2020
dioxus::desktop::launch(App, |c| c);
2121
}
2222

23-
fn App((cx, props): Component<()>) -> Element {
23+
fn App((cx, props): Scope<()>) -> Element {
2424
let text: &mut Vec<String> = cx.use_hook(|_| vec![String::from("abc=def")], |f| f, |_| {});
2525

2626
let first = text.get_mut(0).unwrap();
@@ -43,7 +43,7 @@ impl<'a> Drop for C1Props<'a> {
4343
fn drop(&mut self) {}
4444
}
4545

46-
fn Child1<'a>((cx, props): Component<'a, C1Props>) -> Element<'a> {
46+
fn Child1<'a>((cx, props): Scope<'a, C1Props>) -> Element<'a> {
4747
let (left, right) = props.text.split_once("=").unwrap();
4848

4949
cx.render(rsx! {
@@ -59,7 +59,7 @@ struct C2Props<'a> {
5959
text: &'a str,
6060
}
6161

62-
fn Child2<'a>((cx, props): Component<'a, C2Props>) -> Element<'a> {
62+
fn Child2<'a>((cx, props): Scope<'a, C2Props>) -> Element<'a> {
6363
cx.render(rsx! {
6464
Child3 {
6565
text: props.text
@@ -72,7 +72,7 @@ struct C3Props<'a> {
7272
text: &'a str,
7373
}
7474

75-
fn Child3<'a>((cx, props): Component<'a, C3Props>) -> Element<'a> {
75+
fn Child3<'a>((cx, props): Scope<'a, C3Props>) -> Element<'a> {
7676
cx.render(rsx! {
7777
div { "{props.text}"}
7878
})

examples/calculator.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ struct CalculatorKeyProps<'a> {
116116
onclick: &'a dyn Fn(MouseEvent),
117117
}
118118

119-
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> Element<'a> {
119+
fn CalculatorKey<'a>((cx, props): Scope<'a, CalculatorKeyProps>) -> Element<'a> {
120120
rsx!(cx, button {
121121
class: "calculator-key {props.name}"
122122
onclick: {props.onclick}

examples/framework_benchmark.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ struct ActionButtonProps<'a> {
8080
onclick: &'a dyn Fn(MouseEvent),
8181
}
8282

83-
fn ActionButton<'a>((cx, props): Component<'a, ActionButtonProps>) -> Element<'a> {
83+
fn ActionButton<'a>((cx, props): Scope<'a, ActionButtonProps>) -> Element<'a> {
8484
rsx!(cx, div { class: "col-sm-6 smallpad"
8585
button { class:"btn btn-primary btn-block", r#type: "button", id: "{props.id}", onclick: {props.onclick},
8686
"{props.name}"
@@ -93,7 +93,7 @@ struct RowProps {
9393
row_id: usize,
9494
label: Rc<str>,
9595
}
96-
fn Row((cx, props): Component<RowProps>) -> Element {
96+
fn Row((cx, props): Scope<RowProps>) -> Element {
9797
rsx!(cx, tr {
9898
td { class:"col-md-1", "{props.row_id}" }
9999
td { class:"col-md-1", onclick: move |_| { /* run onselect */ }

examples/hello_world.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ fn main() {
44
dioxus::desktop::launch(App, |c| c);
55
}
66

7-
fn App((cx, props): Component<()>) -> Element {
7+
fn App((cx, props): Scope<()>) -> Element {
88
cx.render(rsx! (
99
div { "Hello, world!" }
1010
))

examples/pattern_model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ struct CalculatorKeyProps<'a> {
7676
onclick: &'a dyn Fn(MouseEvent),
7777
}
7878

79-
fn CalculatorKey<'a>((cx, props): Component<'a, CalculatorKeyProps>) -> Element<'a> {
79+
fn CalculatorKey<'a>((cx, props): Scope<'a, CalculatorKeyProps>) -> Element<'a> {
8080
cx.render(rsx! {
8181
button {
8282
class: "calculator-key {props.name}"

examples/rsx_usage.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ mod baller {
184184
pub struct BallerProps {}
185185

186186
/// This component totally balls
187-
pub fn Baller(_: Component<BallerProps>) -> Element {
187+
pub fn Baller(_: Scope<BallerProps>) -> Element {
188188
todo!()
189189
}
190190
}
@@ -195,7 +195,7 @@ pub struct TallerProps {
195195
}
196196

197197
/// This component is taller than most :)
198-
pub fn Taller(_: Component<TallerProps>) -> Element {
198+
pub fn Taller(_: Scope<TallerProps>) -> Element {
199199
let b = true;
200200
todo!()
201201
}

examples/todomvc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub struct TodoEntryProps {
8585
todo: Rc<TodoItem>,
8686
}
8787

88-
pub fn TodoEntry((cx, props): Component<TodoEntryProps>) -> Element {
88+
pub fn TodoEntry((cx, props): Scope<TodoEntryProps>) -> Element {
8989
let is_editing = use_state(cx, || false);
9090
let contents = use_state(cx, || String::from(""));
9191
let todo = &props.todo;

examples/web_tick.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ struct RowProps {
4545
row_id: usize,
4646
label: Label,
4747
}
48-
fn Row((cx, props): Component<RowProps>) -> Element {
48+
fn Row((cx, props): Scope<RowProps>) -> Element {
4949
let [adj, col, noun] = props.label.0;
5050
cx.render(rsx! {
5151
tr {

packages/core-macro/src/rsx/body.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,11 @@ impl ToTokens for CallBody {
5757
}),
5858
// Otherwise we just build the LazyNode wrapper
5959
None => out_tokens.append_all(quote! {
60-
Some(dioxus::prelude::LazyNodes::new(move |__cx: NodeFactory|{
60+
dioxus::prelude::LazyNodes::new(move |__cx: NodeFactory|{
6161
use dioxus_elements::{GlobalAttributes, SvgAttributes};
6262

6363
#inner
64-
}))
64+
})
6565
}),
6666
};
6767
}

packages/core/.vscode/settings.json

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)