Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v8.x: "Cannot read property 'usePureComponent' of undefined" in withNamespaces.js when nesting withNamespaces() #528

Closed
olivierpascal opened this issue Oct 2, 2018 · 15 comments
Labels

Comments

@olivierpascal
Copy link
Contributor

Maybe withNamespaces does not pass i18nOptions through?

@olivierpascal
Copy link
Contributor Author

To reproduce with react_withHOC:

  1. Replace reactI18nextModule with I18nextProvider
  2. Create a new component Test.js using withNamespaces, ie:
import React from 'react';
import { withNamespaces } from 'react-i18next';

const Test = ({ t }) => (
  <div>Another description: {t('description.part2')}</div>
);

export default withNamespaces("translations")(Test);
  1. Nest it inside App.js component
  2. BAM

@olivierpascal olivierpascal changed the title "Cannot read property 'usePureComponent' of undefined" in withNamespaces.js when nesting withNamespaces() v8.x: "Cannot read property 'usePureComponent' of undefined" in withNamespaces.js when nesting withNamespaces() Oct 2, 2018
@raulfdm
Copy link

raulfdm commented Oct 2, 2018

Maybe #355 related

@jamuhl
Copy link
Member

jamuhl commented Oct 2, 2018

@raulfdm not related to that...just a problem introduced with v8...currently working on a fix.

@raulfdm
Copy link

raulfdm commented Oct 2, 2018

@jamuhl ohh I see.. I downgrade to v7 and start to work again 🤔 .. thanks btw

@jarnovanrhijn
Copy link

Having the same issue. i does however pass i18nOptions.

screenshot 2018-10-02 at 10 41 53

The issue i'm facing is that props.i18n does not exist in NamespacesConsumer.js
screenshot 2018-10-02 at 10 45 10

Will downgrade for now.

@jamuhl
Copy link
Member

jamuhl commented Oct 2, 2018

should be fixed in react-i18next@8.0.5 - please verify

@jamuhl jamuhl added the bug label Oct 2, 2018
@olivierpascal
Copy link
Contributor Author

olivierpascal commented Oct 2, 2018

Thanks! Well, this seems to be fixed but I have another bug, apparently related. Only in production, I still need some time to debug but I believe it comes from utils::initSSR(): TypeError: Cannot set property 'wait' of undefined

L26: props.i18nOptions.wait = false;

@jamuhl
Copy link
Member

jamuhl commented Oct 2, 2018

@olivierpascal should be fixed in react-i18next@8.0.6

@olivierpascal
Copy link
Contributor Author

That was quick!

@pepf
Copy link

pepf commented Oct 2, 2018

should be fixed in react-i18next@8.0.5 - please verify

Using 8.0.6 and cleared my caches, still getting the abovementioned error:

ExceptionsManager.js:84 Unhandled JS Exception: TypeError: TypeError: TypeError: Cannot read property 'usePureComponent' of undefined

Some context:
screen shot 2018-10-02 at 13 53 49

Using it in combination with:

    npmPackages:
      react: 16.3.1 => 16.3.1
      react-native: ~0.56.0 => 0.56.0

@jamuhl
Copy link
Member

jamuhl commented Oct 2, 2018

@pepf are you using I18nextProvider or the.use(reactI18nextModule) ?!? that really should not happen anymore...

@raulfdm
Copy link

raulfdm commented Oct 2, 2018

@pepf usually when I have this weird situation I remove my node_modules and yarn.lock and install everything again. It solve's a lot of issues though 🤷‍♂️

@pepf
Copy link

pepf commented Oct 2, 2018

I'm using the I18nextProvider, but I've been checking the source files, seems to be a caching issue still 😅 Thanks!

@jamuhl
Copy link
Member

jamuhl commented Oct 2, 2018

@pepf thanks for double checking -> if there is still an issue or something not working as intended let me know

getting v8 out was rather demanding - a lot changed under the hood

@jamuhl
Copy link
Member

jamuhl commented Oct 4, 2018

closing this for now....feel free to reopen if finding any other problem

@jamuhl jamuhl closed this as completed Oct 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants