mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-11-29 18:20:30 +08:00
Fix statically replaced HASH_ROUTING env variables
Also moves the HASH_ROUTING env variable from being modified inside the hashRouter.spec.ts into the webserver config in the playwright.config.ipfs.ts Signed-off-by: Sebastian Martinez <me@sebastinez.dev>
This commit is contained in:
+4
-4
@@ -16,7 +16,7 @@ export const activeRouteStore: Readable<Route> = derived(
|
||||
},
|
||||
);
|
||||
|
||||
export const base = window.HASH_ROUTING ? "./" : "/";
|
||||
export const base = import.meta.env.VITE_HASH_ROUTING ? "./" : "/";
|
||||
|
||||
// Gets triggered when clicking on an anchor hash tag e.g. <a href="#header"/>
|
||||
// Allows the jump to a anchor hash
|
||||
@@ -97,7 +97,7 @@ export const push = (newRoute: Route): void => {
|
||||
// one subsequent pop() anyway.
|
||||
historyStore.set([...history, newRoute].slice(-10));
|
||||
|
||||
const path = window.HASH_ROUTING
|
||||
const path = import.meta.env.VITE_HASH_ROUTING
|
||||
? "#" + routeToPath(newRoute)
|
||||
: routeToPath(newRoute);
|
||||
|
||||
@@ -116,7 +116,7 @@ export const pop = (): void => {
|
||||
export function replace(newRoute: Route): void {
|
||||
historyStore.set([newRoute]);
|
||||
|
||||
const path = window.HASH_ROUTING
|
||||
const path = import.meta.env.VITE_HASH_ROUTING
|
||||
? "#" + routeToPath(newRoute)
|
||||
: routeToPath(newRoute);
|
||||
|
||||
@@ -142,7 +142,7 @@ function pathToRoute(path: string): Route | null {
|
||||
}
|
||||
|
||||
const url = new URL(path, window.origin);
|
||||
const segments = window.HASH_ROUTING
|
||||
const segments = import.meta.env.VITE_HASH_ROUTING
|
||||
? url.hash.substring(2).split("#")[0].split("/") // Try to remove any additional hashes at the end of the URL.
|
||||
: url.pathname.substring(1).split("/");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user