Fix hot reloading components with keys (#2886)

* Fix hot reloading components with keys

* include component formatted segment keys, but not dynamic component value

* Fix component_literal_dyn_idx index

* add a new test for hot reloading components with keys

* Even more tests

* make clippy happy

* fix typo
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-08-28 18:53:11 -05:00
1 parent 0e937daaa1
commit 4676171861
7 files changed
+176 -56

No files matched your search

+5 -10
View File
@@ -237,7 +237,7 @@ impl Element {
}
for attr in attrs {
if attr.name.to_string() == "key" {
if attr.name.is_likely_key() {
continue;
}
@@ -301,15 +301,10 @@ impl Element {
}
pub(crate) fn key(&self) -> Option<&AttributeValue> {
for attr in &self.raw_attributes {
if let AttributeName::BuiltIn(name) = &attr.name {
if name == "key" {
return Some(&attr.value);
}
}
}
None
self.raw_attributes
.iter()
.find(|attr| attr.name.is_likely_key())
.map(|attr| &attr.value)
}
fn completion_hints(&self) -> TokenStream2 {