From 29aa0f416e8ccf72021a5784dab4051319c15fde Mon Sep 17 00:00:00 2001 From: Baorong Li Date: Tue, 5 Mar 2019 16:15:02 +0800 Subject: [PATCH] fix Cannot read property 'addEventListener' of null #946 --- src/layouts/PrimaryLayout.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/layouts/PrimaryLayout.js b/src/layouts/PrimaryLayout.js index f3f5e3f..8a5df9b 100644 --- a/src/layouts/PrimaryLayout.js +++ b/src/layouts/PrimaryLayout.js @@ -59,19 +59,18 @@ class PrimaryLayout extends PureComponent { // Localized route name. - const lang = langFromPath(location.pathname); + const lang = langFromPath(location.pathname) const newRouteList = - lang !== 'en' + lang !== 'en' ? routeList.map(item => { - const { name , ...other } = item + const { name, ...other } = item return { ...other, - name: ((item[lang] || {}).name || name), + name: (item[lang] || {}).name || name, } }) : routeList - // Find a route that matches the pathname. const currentRoute = newRouteList.find( _ => _.route && pathMatchRegexp(_.route, location.pathname) @@ -148,7 +147,7 @@ class PrimaryLayout extends PureComponent { document.querySelector('#primaryLayout>div')} + target={() => document.querySelector('#primaryLayout')} />