From 629d0a261b2957daaf72bbb5ef308d5d81366cc0 Mon Sep 17 00:00:00 2001 From: Tomas Roos Date: Wed, 8 Nov 2017 20:37:52 +0100 Subject: [PATCH] messages are availble within initialProps (#3252) This has never been working, we based our intl + locale lookups out of this example and found out when translations wasn't working on page transitions due to the fact that messages gets set to undefined because its trying to destruct in the incorrect level --- examples/with-react-intl/components/PageWithIntl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/with-react-intl/components/PageWithIntl.js b/examples/with-react-intl/components/PageWithIntl.js index 1bcf0afd..108d76c5 100644 --- a/examples/with-react-intl/components/PageWithIntl.js +++ b/examples/with-react-intl/components/PageWithIntl.js @@ -23,7 +23,7 @@ export default (Page) => { // Get the `locale` and `messages` from the request object on the server. // In the browser, use the same values that the server serialized. const {req} = context - const {locale, messages} = req || window.__NEXT_DATA__.props + const {locale, messages} = req || window.__NEXT_DATA__.props.initialProps // Always update the current time on page load/transition because the // will be a new instance even with pushState routing.