@@ -53,12 +53,15 @@ class IFrame extends BaseComponent {
5353
5454 // update the currently active nav + add / update the page's query string
5555 handlePageLoad ( e ) {
56- var queryString = window . location . search ;
56+ const queryString = window . location . search ;
5757 const urlParams = new URLSearchParams ( queryString ) ;
58- let patternParam = urlParams . get ( 'p' ) ;
58+ const patternParam = urlParams . get ( 'p' ) ;
5959
60- if ( e . detail . pattern ) {
61- document . title = 'Pattern Lab - ' + e . detail . pattern ;
60+ const currentPattern =
61+ e . detail . pattern || window . config . defaultPattern || 'all' ;
62+
63+ if ( currentPattern ) {
64+ document . title = 'Pattern Lab - ' + currentPattern ;
6265
6366 const addressReplacement =
6467 window . location . protocol === 'file:'
@@ -68,21 +71,21 @@ class IFrame extends BaseComponent {
6871 window . location . host +
6972 window . location . pathname . replace ( 'index.html' , '' ) +
7073 '?p=' +
71- e . detail . pattern ;
74+ currentPattern ;
7275
7376 // first time hitting a PL page -- no query string on the current page
7477 if ( patternParam === null ) {
7578 window . history . replaceState (
7679 {
77- currentPattern : e . detail . pattern ,
80+ currentPattern : currentPattern ,
7881 } ,
7982 null ,
8083 addressReplacement
8184 ) ;
8285 } else {
8386 window . history . replaceState (
8487 {
85- currentPattern : e . detail . pattern ,
88+ currentPattern : currentPattern ,
8689 } ,
8790 null ,
8891 addressReplacement
0 commit comments