Fix client side liveview links (#3341)
* Fix liveview links * Serve all routes under with_virtual_dom
This commit is contained in:
1 parent
94a499c900
commit
3e1e7f05e7
2 files changed
+12
-1
No files matched your search
@@ -62,6 +62,13 @@ impl LiveviewRouter for Router {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let app = Arc::new(app);
|
let app = Arc::new(app);
|
||||||
|
// Add an extra catch all segment to the route
|
||||||
|
let mut route = route.trim_matches('/').to_string();
|
||||||
|
if route.is_empty() {
|
||||||
|
route = "/*route".to_string();
|
||||||
|
} else {
|
||||||
|
route = format!("/{route}/*route");
|
||||||
|
}
|
||||||
|
|
||||||
self.route(
|
self.route(
|
||||||
&ws_path,
|
&ws_path,
|
||||||
@@ -75,7 +82,7 @@ impl LiveviewRouter for Router {
|
|||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
.route(
|
.route(
|
||||||
route,
|
&route,
|
||||||
get(move || async move { index_page_with_glue(&interpreter_glue(&ws_path)) }),
|
get(move || async move { index_page_with_glue(&interpreter_glue(&ws_path)) }),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -342,6 +342,10 @@ impl History for LiveviewHistory {
|
|||||||
let mut updater_callback = self.updater_callback.write().unwrap();
|
let mut updater_callback = self.updater_callback.write().unwrap();
|
||||||
*updater_callback = callback;
|
*updater_callback = callback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn include_prevent_default(&self) -> bool {
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mod routes {
|
mod routes {
|
||||||
|
|||||||
Reference in new issue
Block a user