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 React from 'react';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
import { withRouter } from 'react-router-dom';
|
||||||
import { Helmet } from'react-helmet';
|
import { Helmet } from'react-helmet';
|
||||||
import { getSettings } from 'soapbox/actions/settings';
|
import { getSettings } from 'soapbox/actions/settings';
|
||||||
import sourceCode from 'soapbox/utils/code';
|
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 (
|
return (
|
||||||
<IntlProvider locale={locale} messages={this.state.messages}>
|
<IntlProvider locale={locale} messages={this.state.messages}>
|
||||||
<ErrorBoundary>
|
<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}>
|
<BrowserRouter basename={FE_SUBDIRECTORY}>
|
||||||
<ScrollContext shouldUpdateScroll={this.shouldUpdateScroll}>
|
<>
|
||||||
<Switch>
|
<Helmet>
|
||||||
{!me && <Route exact path='/' component={PublicLayout} />}
|
<body className={bodyClass} />
|
||||||
<Route exact path='/about/:slug?' component={PublicLayout} />
|
{themeCss && <style id='theme' type='text/css'>{`:root{${themeCss}}`}</style>}
|
||||||
<Route path='/' component={UI} />
|
{customCss && customCss.map(css => (
|
||||||
</Switch>
|
<link rel='stylesheet' href={css} key={css} />
|
||||||
</ScrollContext>
|
))}
|
||||||
|
<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>
|
</BrowserRouter>
|
||||||
</ErrorBoundary>
|
</ErrorBoundary>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
|
|
Loading…
Reference in a new issue