Skip to content

Commit

Permalink
Temporary fix for website book broken navigation (#661)
Browse files Browse the repository at this point in the history
* Reproduce without "content::Content()"

* move cached_sidebar_data area.

* cargo clippy

* cargo clippy

* cargo clippy
  • Loading branch information
Hmikihiro authored Mar 17, 2024
1 parent 34d582b commit 0c5638c
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions website/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,13 @@ async fn get_sidebar(version: Option<&str>) -> SidebarData {
fn switch<G: Html>(route: ReadSignal<Routes>) -> View<G> {
let cached_sidebar_data = create_signal(None::<(Option<String>, SidebarData)>);
provide_context(cached_sidebar_data);
if cached_sidebar_data.with(|x| x.is_none() || x.as_ref().unwrap().0.is_some()) {
spawn_local_scoped(async move {
cached_sidebar_data.set(Some((None, get_sidebar(None).await)));
});
}

let fetch_docs_data = move |url| {
let data = create_resource(docs_preload(url));
if cached_sidebar_data.with(|x| x.is_none() || x.as_ref().unwrap().0.is_some()) {
spawn_local_scoped(async move {
cached_sidebar_data.set(Some((None, get_sidebar(None).await)));
});
}
data
};
let fetch_docs_data = move |url| create_resource(docs_preload(url));
let view = create_memo(on(route, move || match route.get_clone() {
Routes::Index => view! {
div(class="container mx-auto") {
Expand Down

0 comments on commit 0c5638c

Please sign in to comment.