Commit 0d4d7d84 authored by Andrew Razumovsky's avatar Andrew Razumovsky Committed by Tim Neutkens

[with-react-i18next] Fix flickering on page change via <Link /> (#4318)

* Fix flickering on page change via <Link />

* Remove process.browser check
parent 8588e8d8
import { translate } from 'react-i18next'
import { translate, loadNamespaces } from 'react-i18next'
import { getInitialProps, I18n } from '../i18n'
export const withI18next = (namespaces = ['common']) => ComposedComponent => {
......@@ -11,8 +11,12 @@ export const withI18next = (namespaces = ['common']) => ComposedComponent => {
? await ComposedComponent.getInitialProps(ctx)
: {}
const i18nInitialProps =
ctx.req && !process.browser ? getInitialProps(ctx.req, namespaces) : {}
const i18nInitialProps = ctx.req
? getInitialProps(ctx.req, namespaces)
: await loadNamespaces({
components: [{ props: { namespaces } }],
i18n: I18n,
});
return {
...composedInitialProps,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment