diff --git a/packages/yew/src/app_handle.rs b/packages/yew/src/app_handle.rs index 04e3b79afd7..7f66c78ff45 100644 --- a/packages/yew/src/app_handle.rs +++ b/packages/yew/src/app_handle.rs @@ -4,7 +4,6 @@ use std::ops::Deref; use crate::html::{BaseComponent, NodeRef, Scope, Scoped}; -use gloo_utils::document; use std::rc::Rc; use web_sys::Element; @@ -34,20 +33,6 @@ where app } - /// Alternative to `mount_with_props` which replaces the body element with a component which - /// has a body element at the root of the HTML generated by its `view` method. Use this method - /// when you need to manipulate the body element. For example, adding/removing app-wide - /// CSS classes of the body element. - pub(crate) fn mount_as_body_with_props(props: Rc) -> Self { - let html_element = document().document_element().unwrap(); - let body_element = document().body().expect("no body node found"); - html_element - .remove_child(&body_element) - .expect("can't remove body child"); - - Self::mount_with_props(html_element, props) - } - /// Schedule the app for destruction pub fn destroy(mut self) { self.scope.destroy() diff --git a/packages/yew/src/lib.rs b/packages/yew/src/lib.rs index d988d2eccdf..b342d1c14bc 100644 --- a/packages/yew/src/lib.rs +++ b/packages/yew/src/lib.rs @@ -324,19 +324,6 @@ where start_app_with_props(COMP::Properties::default()) } -/// The main entry point of a Yew application. -/// Alternative to `start_app` which replaces the body element with a component which has a body -/// element at the root of the HTML generated by its `view` method. Use this method when you -/// need to manipulate the body element. For example, adding/removing app-wide -/// CSS classes of the body element. -pub fn start_app_as_body() -> AppHandle -where - COMP: BaseComponent, - COMP::Properties: Default, -{ - start_app_with_props_as_body(COMP::Properties::default()) -} - /// The main entry point of a Yew application. This function does the /// same as `start_app_in_element(...)` but allows to start an Yew application with properties. pub fn start_app_with_props_in_element( @@ -365,19 +352,6 @@ where ) } -/// The main entry point of a Yew application. -/// Alternative to `start_app_with_props` which replaces the body element with a component which has a body -/// element at the root of the HTML generated by its `view` method. Use this method when you -/// need to manipulate the body element. For example, adding/removing app-wide -/// CSS classes of the body element. -pub fn start_app_with_props_as_body(props: COMP::Properties) -> AppHandle -where - COMP: BaseComponent, -{ - set_default_panic_hook(); - AppHandle::::mount_as_body_with_props(Rc::new(props)) -} - /// The Yew Prelude /// /// The purpose of this module is to alleviate imports of many common types: diff --git a/website/docs/migration-guides/yew/from-0_19_0-to-0_20_0.mdx b/website/docs/migration-guides/yew/from-0_19_0-to-0_20_0.mdx new file mode 100644 index 00000000000..5a9292d5a28 --- /dev/null +++ b/website/docs/migration-guides/yew/from-0_19_0-to-0_20_0.mdx @@ -0,0 +1,8 @@ +--- +title: "From 0.19.0 to 0.20.0" +--- + +## `_as_body` variant of `start_app` is removed + +This method of controlling body has caused issues in event registration and +SSR hydration. They have been removed. Read more in the [github issue](https://github.com/yewstack/yew/pull/2346).