diff --git a/src/components/Router.tsx b/src/components/Router.tsx index f24c5de1..b9682779 100644 --- a/src/components/Router.tsx +++ b/src/components/Router.tsx @@ -317,7 +317,7 @@ function Router(props: { cache.set(urlWithoutHash, newRoute.props ?? {}); } else if (newRoute.getStaticProps) { - log(props.id, "firstRoute > isClient > request getStaticProps"); + log(props.id, "firstRoute > isClient > request getStaticProps & set cache") await requestStaticPropsAndCacheIt() } } @@ -325,11 +325,11 @@ function Router(props: { else { const cacheData = cache.get(urlWithoutHash) if (cacheData) { - log(props.id, "Not firstRoute > isClient > assign dataFromCache to newRoute.props"); + log(props.id, "not firstRoute > isClient > assign dataFromCache to newRoute.props"); Object.assign(newRoute.props, cacheData); } else if (newRoute.getStaticProps) { - log(props.id, "Not firstRoute > isClient > request getStaticProps"); + log(props.id, "not firstRoute > isClient > request getStaticProps"); await requestStaticPropsAndCacheIt() } diff --git a/src/core/LangService.ts b/src/core/LangService.ts index f4d3484d..ab0e4a71 100644 --- a/src/core/LangService.ts +++ b/src/core/LangService.ts @@ -262,9 +262,6 @@ class LangService { showLangInUrl = this.showLangInUrl() ): TRoute[] { if (routes?.some((el) => !!el._langPath)) { - log( - "Routes have already been formatted by 'addLangParamToRoutes()', return routes." - ); return routes; } diff --git a/src/core/core.ts b/src/core/core.ts index 4102d654..b8446e39 100644 --- a/src/core/core.ts +++ b/src/core/core.ts @@ -287,7 +287,8 @@ export function getRouteFromUrl({ "/", ); const matcher = match(currentRoutePath)(urlWithoutHashAndQuery); - log(id, `"${urlWithoutHashAndQuery}" match with "${currentRoutePath}"?`, !!matcher); + // prettier-ignore + log(id, `url "${urlWithoutHashAndQuery}" match path "${currentRoutePath}"?`,!!matcher); // if current route path match with the param url if (matcher) { @@ -323,7 +324,7 @@ export function getRouteFromUrl({ _context: pParent ? formatRouteObj(pParent) : formattedCurrentRoute, }; - log(id, "getRouteFromUrl: MATCH routeObj", routeObj); + log(id, "match", routeObj); return routeObj; } diff --git a/src/core/staticPropsCache.ts b/src/core/staticPropsCache.ts index 26d49659..28659e19 100644 --- a/src/core/staticPropsCache.ts +++ b/src/core/staticPropsCache.ts @@ -1,6 +1,6 @@ import { Routers } from "./Routers"; import debug from "@wbe/debug"; -const componentName: string = "staticPropsCache"; +const componentName: string = "cache"; const log = debug(`router:${componentName}`); /** @@ -13,16 +13,14 @@ export function staticPropsCache(cache = Routers.staticPropsCache) { */ const get = (key: string): any => { const dataAlreadyExist = Object.keys(cache).some((el) => el === key); - if (!dataAlreadyExist) { - log(`"${key}"page data doesn't exist in cache.`); + log(`"${key}" data doesn't exist in cache.`); return null; } const dataCache = cache[key]; - log("current page data is already in 'cache', we use it.", dataCache); + log("data is already in cache, return it.", dataCache); return dataCache; }; - /** * Set Data in static props cache */