This commit is contained in:
Seth Trowbridge 2024-05-18 12:41:44 -04:00
parent d02b768050
commit 696518a12e

View File

@ -50,13 +50,13 @@ type RouteContextData = {
/** Collection of keys from matched routes ("page/:key/") */ keys: Record<string, string>,
blocked: Signal.Signal<string | false>
}
const context = React.createContext({nestedDepth:0, pathIndex:0, keys:{}, blocked:Signal.signal(false as false|string)} as RouteContextData);
const blocked = Signal.signal(false as false|string)
const context = React.createContext({nestedDepth:0, pathIndex:0, keys:{}, blocked} as RouteContextData);
//// Create Signals
export const pageURL = Signal.signal(new URL(globalThis?.location.href || ""));
export const pagePath = Signal.signal([] as string[]);
Signal.effect(()=>{
//@ts-ignore 1337 hax
if(context){context.__.blocked.value = false;}
blocked.value = false;
pagePath.value = pageURL.value.pathname.split("/").filter(part=>part!="");
});
//// Add handlers