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