Fix base path on web and fullstack (#3247)

* Create a crate for constant serialization of config structs for manganis

* use SerializeConst for the image asset builder

* switch to a declarative macro for assets

* clean up asset macro a bit

* add serializable options for each asset type

* serialize const vec

* Add unique path formatting

* implement the new manganis macro

* optimize assets in the CLI

* Fix clippy

* Fix assets with dioxus formattable

* reduce fuzzing test limits

* use the new syntax in examples

* fix formatting

* Final doc and test pass on const-serialize

* fix avif support

* Fix manganis doc tests

* cache asset optimization

* Split out asset and bundled asset

* make hash pointer width independent

* remove const serialize cargo lock

* Fix manganis macro docs

* all tests passing

* add constvec::is_empty method to fix clippy lint

* remove nasm feature

* simplify test_rsplit_once test so typos passes

* fix range syntax for stable

* revert example change from clippy fix

* remove dioxus-static-site-generation workspace dependency

* always accept unix paths

* fix windows path seperator

* fix folder asset hash

* Optimize assets in a blocking task

* Fix asset options docs

* Document Asset and BundledAsset

* move manganis back into it's own folder

* simplify the linker macro a bit

* add more docs to AssetParser expansion

* fix manganis core doc test

* add image format helpers

* Fill in new cargo.tomls

* fix folders with explicit options

* Split by  both unix and windows path separators and take the smallest one

* fix string length

* Fix base path on web and fullstack

* Fix assets with base path

* fix fullstack base route with trailing slash

* fix clippy
This commit is contained in:
Evan Almloff authored and GitHub committed 2024-11-27 10:40:55 +03:00
1 parent 1e8693a0e8
commit 3d62fbf021
20 files changed
+254 -41

No files matched your search

+3 -1
View File
@@ -163,6 +163,8 @@ pub fn Link(props: LinkProps) -> Element {
NavigationTarget::Internal(url) => url.clone(),
NavigationTarget::External(route) => route.clone(),
};
// Add the history's prefix to the href for use in the rsx
let full_href = router.prefix().unwrap_or_default() + &href;
let mut class_ = String::new();
if let Some(c) = class {
@@ -240,7 +242,7 @@ pub fn Link(props: LinkProps) -> Element {
a {
onclick: action,
"onclick": liveview_prevent_default,
href,
href: full_href,
onmounted: onmounted,
class,
rel,
+2 -5
View File
@@ -47,9 +47,6 @@ pub(crate) type RoutingCallback<R> =
pub(crate) type AnyRoutingCallback = Arc<dyn Fn(RouterContext) -> Option<NavigationTarget>>;
struct RouterContextInner {
/// The current prefix.
prefix: Option<String>,
unresolved_error: Option<ExternalNavigationFailure>,
subscribers: Arc<Mutex<HashSet<ReactiveContext>>>,
@@ -105,7 +102,6 @@ impl RouterContext {
let mapping = consume_child_route_mapping();
let myself = RouterContextInner {
prefix: Default::default(),
unresolved_error: None,
subscribers: subscribers.clone(),
routing_callback: cfg.on_update.map(|update| {
@@ -259,7 +255,8 @@ impl RouterContext {
/// The prefix that is currently active.
pub fn prefix(&self) -> Option<String> {
self.inner.read().prefix.clone()
let history = history();
history.current_prefix()
}
/// Clear any unresolved errors