Skip to content

Commit

Permalink
Optimise Code size?
Browse files Browse the repository at this point in the history
  • Loading branch information
futursolo committed Apr 22, 2022
1 parent d95d994 commit 32a3ca5
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions packages/yew/src/html/component/scope.rs
Expand Up @@ -353,7 +353,8 @@ mod feat_csr_ssr {
})
}

pub(super) fn schedule_update(&self) {
#[inline]
fn schedule_update(&self) {
scheduler::push_component_update(Box::new(UpdateRunner {
state: self.state.clone(),
}));
Expand Down Expand Up @@ -415,6 +416,22 @@ mod feat_csr {
}
}

fn schedule_props_update(
state: Shared<Option<ComponentState>>,
props: Rc<dyn Any>,
node_ref: NodeRef,
next_sibling: NodeRef,
) {
scheduler::push_component_props_update(Box::new(PropsUpdateRunner {
state,
node_ref,
next_sibling,
props,
}));
// Not guaranteed to already have the scheduler started
scheduler::start();
}

impl<COMP> Scope<COMP>
where
COMP: BaseComponent,
Expand Down Expand Up @@ -463,14 +480,7 @@ mod feat_csr {
#[cfg(debug_assertions)]
super::super::log_event(self.id, "reuse");

scheduler::push_component_props_update(Box::new(PropsUpdateRunner {
state: self.state.clone(),
node_ref,
next_sibling,
props,
}));
// Not guaranteed to already have the scheduler started
scheduler::start();
schedule_props_update(self.state.clone(), props, node_ref, next_sibling)
}
}

Expand Down

0 comments on commit 32a3ca5

Please sign in to comment.