Browse Source

Fix bug when no search param specified

John R. Supplee 4 years ago
parent
commit
e70a1f0a60
1 changed files with 6 additions and 4 deletions
  1. 6 4
      config/router.js

+ 6 - 4
config/router.js

@@ -160,10 +160,12 @@ FlowRouter.route('/global-search', {
     Utils.manageMatomo();
     Utils.manageMatomo();
     DocHead.setTitle(TAPi18n.__('globalSearch-title'));
     DocHead.setTitle(TAPi18n.__('globalSearch-title'));
 
 
-    Session.set(
-      'globalQuery',
-      decodeURIComponent(FlowRouter.getQueryParam('q')),
-    );
+    if (FlowRouter.getQueryParam('q')) {
+      Session.set(
+        'globalQuery',
+        decodeURIComponent(FlowRouter.getQueryParam('q')),
+      );
+    }
     BlazeLayout.render('defaultLayout', {
     BlazeLayout.render('defaultLayout', {
       headerBar: 'globalSearchHeaderBar',
       headerBar: 'globalSearchHeaderBar',
       content: 'globalSearch',
       content: 'globalSearch',