Skip to content

Commit

Permalink
add ability to update app props (#2951)
Browse files Browse the repository at this point in the history
  • Loading branch information
WorldSEnder committed Nov 8, 2022
1 parent b649e9d commit 3b4fa88
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions packages/yew/src/app_handle.rs
Expand Up @@ -46,6 +46,21 @@ where
app
}

/// Update the properties of the app's root component.
///
/// This can be an alternative to sending and handling messages. The existing component will be
/// reused and have its properties updates. This will presumably trigger a re-render, refer to
/// the [`changed`] lifecycle for details.
///
/// [`changed`]: crate::Component::changed
#[tracing::instrument(
level = tracing::Level::DEBUG,
skip_all,
)]
pub fn update(&mut self, new_props: COMP::Properties) {
self.scope.reuse(Rc::new(new_props), NodeRef::default())
}

/// Schedule the app for destruction
#[tracing::instrument(
level = tracing::Level::DEBUG,
Expand Down

0 comments on commit 3b4fa88

Please sign in to comment.