Helmet: wrap withRouter, probably fix page title getting stuck
This commit is contained in:
parent
b343a403e8
commit
f6b1bca574
2 changed files with 19 additions and 16 deletions
|
@ -1,6 +1,7 @@
|
|||
import React from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import PropTypes from 'prop-types';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { Helmet } from'react-helmet';
|
||||
import { getSettings } from 'soapbox/actions/settings';
|
||||
import sourceCode from 'soapbox/utils/code';
|
||||
|
@ -54,4 +55,4 @@ class SoapboxHelmet extends React.Component {
|
|||
|
||||
}
|
||||
|
||||
export default connect(mapStateToProps)(SoapboxHelmet);
|
||||
export default withRouter(connect(mapStateToProps)(SoapboxHelmet));
|
||||
|
|
|
@ -141,22 +141,24 @@ class SoapboxMount extends React.PureComponent {
|
|||
return (
|
||||
<IntlProvider locale={locale} messages={this.state.messages}>
|
||||
<ErrorBoundary>
|
||||
<Helmet>
|
||||
<body className={bodyClass} />
|
||||
{themeCss && <style id='theme' type='text/css'>{`:root{${themeCss}}`}</style>}
|
||||
{customCss && customCss.map(css => (
|
||||
<link rel='stylesheet' href={css} key={css} />
|
||||
))}
|
||||
<meta name='theme-color' content={this.props.brandColor} />
|
||||
</Helmet>
|
||||
<BrowserRouter basename={FE_SUBDIRECTORY}>
|
||||
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
|
||||
<Switch>
|
||||
{!me && <Route exact path='/' component={PublicLayout} />}
|
||||
<Route exact path='/about/:slug?' component={PublicLayout} />
|
||||
<Route path='/' component={UI} />
|
||||
</Switch>
|
||||
</ScrollContext>
|
||||
<>
|
||||
<Helmet>
|
||||
<body className={bodyClass} />
|
||||
{themeCss && <style id='theme' type='text/css'>{`:root{${themeCss}}`}</style>}
|
||||
{customCss && customCss.map(css => (
|
||||
<link rel='stylesheet' href={css} key={css} />
|
||||
))}
|
||||
<meta name='theme-color' content={this.props.brandColor} />
|
||||
</Helmet>
|
||||
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
|
||||
<Switch>
|
||||
{!me && <Route exact path='/' component={PublicLayout} />}
|
||||
<Route exact path='/about/:slug?' component={PublicLayout} />
|
||||
<Route path='/' component={UI} />
|
||||
</Switch>
|
||||
</ScrollContext>
|
||||
</>
|
||||
</BrowserRouter>
|
||||
</ErrorBoundary>
|
||||
</IntlProvider>
|
||||
|
|
Loading…
Reference in a new issue