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

ReferenceError: setImmediate is not defined #787

Closed
krnlde opened this issue Mar 14, 2019 · 2 comments
Closed

ReferenceError: setImmediate is not defined #787

krnlde opened this issue Mar 14, 2019 · 2 comments

Comments

@krnlde
Copy link

krnlde commented Mar 14, 2019

Describe the bug
When trying to call the callback method provided by read in a plugin, the error ReferenceError: setImmediate is not defined is thrown into the console.

setImmediate() is a non-standard API and shouldn't be used in frontend code.

Occurs in react-i18next version
Occurs in the latest version of react-i18next which is currently v10.5.0.

https://github.com/i18next/react-i18next/blob/v10.5.0/src/utils.js#L32

OS (please complete the following information):

> yarn info
{ yarn:
   '1.15.0',
  node:
   '11.11.0',
  v8:
   '7.0.276.38-node.18',
  uv:
   '1.26.0',
  zlib:
   '1.2.11',
  brotli:
   '1.0.7',
  ares:
   '1.15.0',
  modules:
   '67',
  nghttp2:
   '1.34.0',
  napi:
   '4',
  llhttp:
   '1.1.1',
  http_parser:
   '2.8.0',
  openssl:
   '1.1.1a',
  cldr:
   '34.0',
  icu:
   '63.1',
  tz:
   '2018e',
  unicode:
   '11.0' }
Google Chrome: Version 72.0.3626.121 (Official Build) (64-bit)

Additional context
We use a custom backend-plugin as described here, which eventually calls the callback from the read property like here:

// ...
read: function(language, namespace, callback) {
    /* return resources */
    callback(null, {
      key: 'value'
    });
  },
// ...
@jamuhl
Copy link
Member

jamuhl commented Mar 14, 2019

replaced with a setTimeout(()=>(),0) in react-i18next@10.5.1

If you like this module don’t forget to star this repo. Make a tweet, share the word or have a look at our https://locize.com to support the devs of this project -> there are many ways to help this project 🙏

@krnlde
Copy link
Author

krnlde commented Mar 14, 2019

That was fast man! Thank you so much!

Edit: Updated and executed: works perfectly. Closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants