v0.10
Back to the...
-
⚡️ Features
Future
support 🎉 AComponent
can update following the completion of aFuture
. Check out this example to see how it works. This approach was borrowed from a fork of Yew calledplaster
created by @carlosdp. [@hgzimmerman, #717]- Added the
agent
andservices
features so that those modules can be disabled (useful if you are switching to usingFuture
s). [@hgzimmerman, #684] - Add
ref
keyword for allowing aComponent
to have a direct reference to its rendered elements. For example, you can now easily focus an<input>
element after mounting. [@jstarry, #715]
use stdweb::web::html_element::InputElement; use stdweb::web::IHtmlElement; use yew::*; pub struct Input { node_ref: NodeRef, } impl Component for Input { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Input { node_ref: NodeRef::default(), } } fn mounted(&mut self) -> ShouldRender { if let Some(input) = self.node_ref.try_into::<InputElement>() { input.focus(); } false } fn update(&mut self, _: Self::Message) -> ShouldRender { false } fn view(&self) -> Html<Self> { html! { <input ref=self.node_ref.clone() type="text" /> } } }
- Make
Agent
related typespublic
to allow other crates to create custom agents. [@dunnock, #721] Component::change
will now returnfalse
for components that haveComponent::Properties == ()
. [@kellytk, #690]]- Updated
wasm-bindgen
dependency to0.2.54
. Please update yourwasm-bindgen-cli
tool by runningcargo install --force --version 0.2.54 -- wasm-bindgen-cli
. [@jstarry, #730], [@ctaggart, #681]
-
🛠 Fixes
- Fixed the mount order of components. The root component will be mounted after all descendants have been mounted. [@jstarry, #725]
- All public items now implement
Debug
. [@hgzimmerman, #673]
-
🚨 Breaking changes
-
Minimum rustc version has been bumped to
1.39.0
forFuture
support. [@jstarry, #730] -
Component
now has a requiredview
method and automatically implements theRenderable
trait. Theview
method in theRenderable
trait has been renamed torender
. [@jstarry, #563]Before:
impl Component for Model { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Model {} } fn update(&mut self, msg: Self::Message) -> ShouldRender { true } } impl Renderable<Model> for Model { fn view(&self) -> Html<Self> { html! { "hello" } } }
After:
impl Component for Model { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Model {} } fn update(&mut self, msg: Self::Message) -> ShouldRender { true } fn view(&self) -> Html<Self> { html! { "hello" } } }
-
Removed the
Transferable
trait since it did no more than extend the serdeSerialize
andDeserialize
traits. [@hgzimmerman, #319]Before:
impl Transferable for Input {} #[derive(Serialize, Deserialize)] pub enum Input { Connect, }
After:
#[derive(Serialize, Deserialize)] pub enum Input { Connect, }
-
WebSocketService::connect
will now return aResult
in order to stop panicking on malformed urls. [@lizhaoxian, #727] -
VTag
now is boxed withinVNode
to shrink the size of its enum representation. [@hgzimmerman, #675]
-