Skip to content

Commit 39e0cce

Browse files
clean up console logs
1 parent 51c4ebe commit 39e0cce

File tree

1 file changed

+2
-13
lines changed

1 file changed

+2
-13
lines changed

packages/cli/src/lib/router.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,25 +24,18 @@ document.addEventListener('click', async function(e) {
2424
return outlet.getAttribute('data-route') === targetUrl.pathname;
2525
})[0];
2626

27-
console.debug({ currentUrl });
28-
console.debug({ targetUrl });
29-
3027
// maintain the app shell if we are navigating between pages that are built from the same page template
3128
// also, some routes may be SSR, so we may not always match on a static route
3229
if (routerOutlet && routerOutlet.getAttribute('data-template') === window.__greenwood.currentTemplate) {
3330
const { hash, pathname } = targetUrl;
34-
console.debug('TARGET PATHNAME', { pathname });
35-
console.debug('TARGET HASH', { hash });
3631

3732
if (currentUrl.pathname !== pathname) {
38-
console.debug('111 PUSH STATE TO NEW PATHNAME');
3933
await routerOutlet.loadRoute();
40-
// history.pushState({}, '', `${targetUrl.pathname}${targetUrl.hash}`);
34+
4135
history.pushState({}, '', pathname);
4236
}
4337

4438
if (hash !== '') {
45-
console.debug('222 HASH');
4639
currentUrl.hash = hash;
4740
}
4841
} else {
@@ -53,17 +46,14 @@ document.addEventListener('click', async function(e) {
5346
}
5447
});
5548

56-
window.addEventListener('popstate', (event) => {
49+
window.addEventListener('popstate', () => {
5750
try {
58-
console.debug('popstate', { event });
5951
const targetRoute = window.location;
6052
const routerOutlet = Array.from(document.getElementsByTagName('greenwood-route')).filter(outlet => {
6153
return outlet.getAttribute('data-route') === targetRoute.pathname;
6254
})[0];
6355

6456
if (routerOutlet) {
65-
console.debug('popstate loadRoute');
66-
// TODO do we need to handle hash here too?
6757
routerOutlet.loadRoute();
6858
}
6959
} catch (err) {
@@ -78,7 +68,6 @@ class RouteComponent extends HTMLElement {
7868
await fetch(key)
7969
.then(res => res.text())
8070
.then((response) => {
81-
console.debug('HTML LOADED!!!');
8271
document.getElementsByTagName('router-outlet')[0].innerHTML = response;
8372
});
8473
}

0 commit comments

Comments
 (0)