mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-10 14:44:12 +00:00
use __varibles
This commit is contained in:
parent
7acc6a553f
commit
94169083f5
2 changed files with 12 additions and 12 deletions
|
@ -38,7 +38,7 @@ fn app(cx: Scope) -> Element {
|
|||
if rsx_code.get().is_none() {
|
||||
let rsx_text_index: RsxTextIndex = cx.consume_context().unwrap();
|
||||
let read = rsx_text_index.read();
|
||||
rsx_code.set(Some(read.get(&line_num).unwrap().clone()));
|
||||
rsx_code.set(Some(read.get(&__line_num).unwrap().clone()));
|
||||
}
|
||||
(*rsx_code.current()).clone().unwrap()
|
||||
},
|
||||
|
@ -53,7 +53,7 @@ fn app(cx: Scope) -> Element {
|
|||
onclick: move |_|{
|
||||
if let Some(code) = rsx_code.get(){
|
||||
let rsx_text_index: RsxTextIndex = cx.consume_context().unwrap();
|
||||
rsx_text_index.insert(line_num.clone(), code.clone());
|
||||
rsx_text_index.insert(__line_num.clone(), code.clone());
|
||||
}
|
||||
},
|
||||
"submit"
|
||||
|
|
|
@ -192,29 +192,29 @@ pub fn rsx(s: TokenStream) -> TokenStream {
|
|||
let captured = CapturedContextBuilder::from_call_body(body);
|
||||
quote! {
|
||||
{
|
||||
let line_num = get_line_num();
|
||||
let rsx_text_index: RsxTextIndex = cx.consume_context().unwrap();
|
||||
let __line_num = get_line_num();
|
||||
let __rsx_text_index: RsxTextIndex = cx.consume_context().unwrap();
|
||||
// only the insert the rsx text once
|
||||
if !rsx_text_index.read().contains_key(&line_num){
|
||||
rsx_text_index.insert(
|
||||
line_num.clone(),
|
||||
if !__rsx_text_index.read().contains_key(&__line_num){
|
||||
__rsx_text_index.insert(
|
||||
__line_num.clone(),
|
||||
#rsx_text.to_string(),
|
||||
);
|
||||
}
|
||||
LazyNodes::new(move |__cx|{
|
||||
if let Some(text) = {
|
||||
let read = rsx_text_index.read();
|
||||
if let Some(__text) = {
|
||||
let read = __rsx_text_index.read();
|
||||
// clone prevents deadlock on nested rsx calls
|
||||
read.get(&line_num).cloned()
|
||||
read.get(&__line_num).cloned()
|
||||
} {
|
||||
interpert_rsx(
|
||||
__cx,
|
||||
&text,
|
||||
&__text,
|
||||
#captured
|
||||
)
|
||||
}
|
||||
else {
|
||||
panic!("rsx: line number {:?} not found in rsx index", line_num);
|
||||
panic!("rsx: line number {:?} not found in rsx index", __line_num);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue