fix: use arcwake instead of rcwake

This commit is contained in:
Jonathan Kelley committed 2022-12-20 11:13:06 -08:00
1 parent 651ab3e7e3
commit 2fa3fe1fc0
16 files changed
+326 -79

No files matched your search

+14 -7
View File
@@ -1,4 +1,4 @@
use std::marker::PhantomData;
use std::{marker::PhantomData, panic::AssertUnwindSafe};
use crate::{
innerlude::Scoped,
@@ -62,12 +62,19 @@ where
}
fn render(&'a self, cx: &'a ScopeState) -> RenderReturn<'a> {
let scope: &mut Scoped<P> = cx.bump().alloc(Scoped {
props: &self.props,
scope: cx,
});
let res = std::panic::catch_unwind(AssertUnwindSafe(move || {
// Call the render function directly
let scope: &mut Scoped<P> = cx.bump().alloc(Scoped {
props: &self.props,
scope: cx,
});
// Call the render function directly
(self.render_fn)(scope).into_return(cx)
(self.render_fn)(scope).into_return(cx)
}));
match res {
Ok(e) => e,
Err(_) => RenderReturn::default(),
}
}
}