fix render macro

This commit is contained in:
Evan Almloff authored and Jonathan Kelley committed 2024-01-08 19:04:56 -08:00
1 parent a0ce5493ea
commit 0a35b5a670
3 files changed
+53 -4

No files matched your search

+9 -2
View File
@@ -1,4 +1,4 @@
use std::ptr::NonNull;
use crate::ScopeState;use std::ptr::NonNull;
use crate::{
innerlude::DirtyScope, nodes::RenderReturn, nodes::VNode, virtual_dom::VirtualDom,
@@ -174,7 +174,14 @@ impl VirtualDom {
scope.borrowed_props.borrow_mut().clear();
// Now that all the references are gone, we can safely drop our own references in our listeners.
let mut listeners = scope.attributes_to_drop_before_render.borrow_mut();
scope.drop_listeners();
}
}
impl ScopeState {
/// Drop all listeners that were allocated in the bump allocator.
pub(crate) fn drop_listeners(&self) {
let mut listeners = self.attributes_to_drop_before_render.borrow_mut();
listeners.drain(..).for_each(|listener| {
let listener = unsafe { &*listener };
if let AttributeValue::Listener(l) = &listener.value {