Fix hot reload diffing to empty rsx (#3567)
* Fix hot reloading to empty rsx * Only normalize the template when hot reloading and rendering * add a test for emptying out an rsx block in hot reloading
This commit is contained in:
1 parent
2c6a5212fc
commit
f99e50b0aa
3 files changed
+61
-26
No files matched your search
@@ -467,6 +467,32 @@ fn invalid_cases() {
|
||||
assert!(added.is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn invalid_empty_rsx() {
|
||||
let old_template = quote! {
|
||||
div {
|
||||
for item in vec![1, 2, 3, 4] {
|
||||
div { "asasddasdasd" }
|
||||
div { "123" }
|
||||
}
|
||||
for item in vec![4, 5, 6] {
|
||||
span { "asasddasdasd" }
|
||||
span { "123" }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// empty out the whole rsx block
|
||||
let new_template = quote! {};
|
||||
|
||||
let location = "file:line:col:0";
|
||||
|
||||
let old_template: CallBody = syn::parse2(old_template).unwrap();
|
||||
let new_template: CallBody = syn::parse2(new_template).unwrap();
|
||||
|
||||
assert!(hotreload_callbody::<Mock>(&old_template, &new_template).is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn attributes_reload() {
|
||||
let old = quote! {
|
||||
|
||||
Reference in new issue
Block a user