Skip to content

Commit 9136b8f

Browse files
committed
Fixes alerts closing
1 parent ec77441 commit 9136b8f

File tree

1 file changed

+13
-19
lines changed

1 file changed

+13
-19
lines changed

front/src/components/app.rs

Lines changed: 13 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ pub fn Component() -> yew::Html {
6060
let context = yew::functional::use_reducer(Context::default);
6161

6262
yew::html! {
63-
<ComponentLoc {context} />
63+
<yew::ContextProvider<crate::Context> context={ context.clone() }>
64+
<ComponentLoc {context} />
65+
</yew::ContextProvider<crate::Context>>
6466
}
6567
}
6668

@@ -167,25 +169,17 @@ impl yew::Component for ComponentLoc {
167169
should_render
168170
}
169171

170-
fn view(&self, ctx: &yew::Context<Self>) -> yew::Html {
171-
let context = &ctx.props().context;
172-
173-
yew::html! {
174-
<yew::ContextProvider<crate::Context> context={ context.clone() }>
175-
{
176-
if self.auth {
177-
yew::html! {
178-
<yew_router::router::BrowserRouter>
179-
<yew_router::Switch<Route> render={ switch } />
180-
</yew_router::router::BrowserRouter>
181-
}
182-
} else {
183-
yew::html! {
184-
<super::Login />
185-
}
186-
}
172+
fn view(&self, _: &yew::Context<Self>) -> yew::Html {
173+
if self.auth {
174+
yew::html! {
175+
<yew_router::router::BrowserRouter>
176+
<yew_router::Switch<Route> render={ switch } />
177+
</yew_router::router::BrowserRouter>
178+
}
179+
} else {
180+
yew::html! {
181+
<super::Login />
187182
}
188-
</yew::ContextProvider<crate::Context>>
189183
}
190184
}
191185

0 commit comments

Comments
 (0)