feat: add send + sync for safety
This commit is contained in:
1 file changed
+2
-2
@@ -588,7 +588,7 @@ impl ScopeState {
|
||||
/// Create a subscription that schedules a future render for the reference component
|
||||
///
|
||||
/// ## Notice: you should prefer using prepare_update and get_scope_id
|
||||
pub fn schedule_update(&self) -> Arc<dyn Fn() + 'static> {
|
||||
pub fn schedule_update(&self) -> Arc<dyn Fn() + Send + Sync + 'static> {
|
||||
let (chan, id) = (self.tasks.sender.clone(), self.scope_id());
|
||||
Arc::new(move || {
|
||||
let _ = chan.unbounded_send(SchedulerMsg::Immediate(id));
|
||||
@@ -600,7 +600,7 @@ impl ScopeState {
|
||||
/// A component's ScopeId can be obtained from `use_hook` or the [`ScopeState::scope_id`] method.
|
||||
///
|
||||
/// This method should be used when you want to schedule an update for a component
|
||||
pub fn schedule_update_any(&self) -> Arc<dyn Fn(ScopeId)> {
|
||||
pub fn schedule_update_any(&self) -> Arc<dyn Fn(ScopeId) + Send + Sync> {
|
||||
let chan = self.tasks.sender.clone();
|
||||
Arc::new(move |id| {
|
||||
let _ = chan.unbounded_send(SchedulerMsg::Immediate(id));
|
||||
|
||||
Reference in new issue
Block a user