@@ -53,12 +53,15 @@ class IFrame extends BaseComponent {
53
53
54
54
// update the currently active nav + add / update the page's query string
55
55
handlePageLoad ( e ) {
56
- var queryString = window . location . search ;
56
+ const queryString = window . location . search ;
57
57
const urlParams = new URLSearchParams ( queryString ) ;
58
- let patternParam = urlParams . get ( 'p' ) ;
58
+ const patternParam = urlParams . get ( 'p' ) ;
59
59
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 ;
62
65
63
66
const addressReplacement =
64
67
window . location . protocol === 'file:'
@@ -68,21 +71,21 @@ class IFrame extends BaseComponent {
68
71
window . location . host +
69
72
window . location . pathname . replace ( 'index.html' , '' ) +
70
73
'?p=' +
71
- e . detail . pattern ;
74
+ currentPattern ;
72
75
73
76
// first time hitting a PL page -- no query string on the current page
74
77
if ( patternParam === null ) {
75
78
window . history . replaceState (
76
79
{
77
- currentPattern : e . detail . pattern ,
80
+ currentPattern : currentPattern ,
78
81
} ,
79
82
null ,
80
83
addressReplacement
81
84
) ;
82
85
} else {
83
86
window . history . replaceState (
84
87
{
85
- currentPattern : e . detail . pattern ,
88
+ currentPattern : currentPattern ,
86
89
} ,
87
90
null ,
88
91
addressReplacement
0 commit comments