Skip to content

Commit

Permalink
xilem: Remove lingering cx (use ctx) (linebender#547)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Aug 25, 2024
1 parent c1732f4 commit 0914079
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions xilem/src/view/flex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,8 +448,8 @@ where

type ViewState = V::ViewState;

fn build(&self, cx: &mut ViewCtx) -> (Self::Element, Self::ViewState) {
let (pod, state) = self.view.build(cx);
fn build(&self, ctx: &mut ViewCtx) -> (Self::Element, Self::ViewState) {
let (pod, state) = self.view.build(ctx);
(
FlexElement::Child(pod.inner.boxed().into(), self.params),
state,
Expand Down
14 changes: 7 additions & 7 deletions xilem_web/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ struct AppInner<State, Fragment: DomFragment<State>, InitFragment> {
fragment_append_scratch: AppendVec<AnyPod>,
vec_splice_scratch: Vec<AnyPod>,
elements: Vec<AnyPod>,
cx: ViewCtx,
ctx: ViewCtx,
}

pub(crate) trait AppRunner {
Expand All @@ -54,7 +54,7 @@ where
pub fn new(root: impl AsRef<web_sys::Node>, data: State, app_logic: InitFragment) -> Self {
let inner = AppInner::new(root.as_ref().clone(), data, app_logic);
let app = App(Rc::new(RefCell::new(inner)));
app.0.borrow_mut().cx.set_runner(app.clone());
app.0.borrow_mut().ctx.set_runner(app.clone());
app
}

Expand All @@ -73,15 +73,15 @@ impl<State, Fragment: DomFragment<State>, InitFragment: FnMut(&mut State) -> Fra
AppInner<State, Fragment, InitFragment>
{
pub fn new(root: web_sys::Node, data: State, app_logic: InitFragment) -> Self {
let cx = ViewCtx::default();
let ctx = ViewCtx::default();
AppInner {
data,
root,
app_logic,
fragment: None,
fragment_state: None,
elements: Vec::new(),
cx,
ctx,
fragment_append_scratch: Default::default(),
vec_splice_scratch: Default::default(),
}
Expand All @@ -90,7 +90,7 @@ impl<State, Fragment: DomFragment<State>, InitFragment: FnMut(&mut State) -> Fra
fn ensure_app(&mut self) {
if self.fragment.is_none() {
let fragment = (self.app_logic)(&mut self.data);
let state = fragment.seq_build(&mut self.cx, &mut self.fragment_append_scratch);
let state = fragment.seq_build(&mut self.ctx, &mut self.fragment_append_scratch);
self.fragment = Some(fragment);
self.fragment_state = Some(state);

Expand Down Expand Up @@ -138,15 +138,15 @@ where
&mut inner.elements,
&mut inner.vec_splice_scratch,
&inner.root,
inner.cx.fragment.clone(),
inner.ctx.fragment.clone(),
false,
#[cfg(feature = "hydration")]
false,
);
new_fragment.seq_rebuild(
fragment,
inner.fragment_state.as_mut().unwrap(),
&mut inner.cx,
&mut inner.ctx,
&mut dom_children_splice,
);
*fragment = new_fragment;
Expand Down

0 comments on commit 0914079

Please sign in to comment.