move router_agent.send(RouteRequest::GetCurrentRoute) to create lifecycle
@@ -176,6 +176,7 @@ where
fn create(props: Self::Properties, link: ComponentLink<Self>) -> Self {
let callback = link.callback(Msg::UpdateRoute);
let router_agent = RouteAgentBridge::new(callback);
+ router_agent.send(RouteRequest::GetCurrentRoute);
Router {
switch: Default::default(), /* This must be updated by immediately requesting a route
@@ -185,12 +186,6 @@ where
}
}
- fn rendered(&mut self, first_render: bool) {
- if first_render {
- self.router_agent.send(RouteRequest::GetCurrentRoute);
- }
- }
-
fn update(&mut self, msg: Self::Message) -> ShouldRender {
match msg {
Msg::UpdateRoute(route) => {
