Skip to content

Commit

Permalink
Fix dereference
Browse files Browse the repository at this point in the history
  • Loading branch information
DanikVitek committed Sep 17, 2023
1 parent da287df commit 67c389a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 1 addition & 4 deletions leptos_dom/src/events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@ pub fn add_event_listener<E>(
}

let cb = Closure::wrap(cb as Box<dyn FnMut(E)>).into_js_value();
let key = {
let key = key.borrow();
intern(&key)
};
let key = intern(&*key.borrow());
_ = js_sys::Reflect::set(target, &JsValue::from_str(&key), &cb);
add_delegated_event_listener(&key, event_name, options);
}
Expand Down
10 changes: 8 additions & 2 deletions leptos_dom/src/html.rs
Original file line number Diff line number Diff line change
Expand Up @@ -785,15 +785,21 @@ impl<El: ElementDescriptor + 'static> HtmlElement<El> {
);

let new_classes = classes.iter().flat_map(|classes| {
classes.borrow().split_whitespace()
classes
.borrow()
.split_whitespace()
.collect::<SmallVec<[_; 4]>>()
});

if let Some(prev_classes) = prev_classes {
let new_classes =
new_classes.collect::<SmallVec<[_; 4]>>();
let mut old_classes =
prev_classes.iter().flat_map(|classes| {
classes.borrow().split_whitespace()
classes
.borrow()
.split_whitespace()
.collect::<SmallVec<[_; 4]>>()
});

// Remove old classes
Expand Down

0 comments on commit 67c389a

Please sign in to comment.