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

Object.keys: argument is not an Object in redux-starter-kit.esm.js #152

Closed
paul-mcgrath opened this issue Jul 8, 2019 · 6 comments
Closed

Comments

@paul-mcgrath
Copy link

paul-mcgrath commented Jul 8, 2019

Hi there,

I'm having an issue using this project with IE11, specifically with this error message in the redux-starter-kit.esm.js file:

Object.keys: argument is not an Object

The issue occurs in the following method on the third line :

  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i] != null ? arguments[i] : {};
    var ownKeys = Object.keys(source);  // <-- error occurs here

    if (typeof Object.getOwnPropertySymbols === 'function') {
      ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) {
        return Object.getOwnPropertyDescriptor(source, sym).enumerable;
      }));
    }

    ownKeys.forEach(function (key) {
      _defineProperty(target, key, source[key]);
    });
  }

  return target;
}

From digging a bit deeper, it seems to try and call Object.keys on a value of false, which then fails in IE11.

The current behaviour in Chrome is to return an empty array when calling Object.keys() on a non-object, but polyfilling IE11's Object.keys() method has so far been unsuccessful.

Should this starter kit work with IE11 out of the box, or is there some guidance on compatibility?

@markerikson
Copy link
Collaborator

Hmm. I'll be honest and say I've put zero thought into browser compat issues so far.

That particular chunk of code appears to be a Babel polyfill for the object spread operator.

What input and stack trace is leading to that particular edge case getting hit?

@dcp12345678
Copy link

@markerikson , I got this same error today. In your code for configureStore, you are calling _objectSpread. That is where the blow up happens when running on IE11.

I tried the react-app-polyfill but it made no difference in this case.

  if (devTools) {
    finalCompose = composeWithDevTools(_objectSpread({    // <--- here's the call
      // Enable capture of stack traces for dispatched Redux actions
      trace: !IS_PRODUCTION
    }, _typeof(devTools) === 'object' && devTools));
  }

@markerikson
Copy link
Collaborator

Again, to be clear, this is not "our code". That is a Babel build artifact. The actual source is:

https://github.com/reduxjs/redux-starter-kit/blob/987c21ec154ff56e3d6cbddde55eaeb768f86ce2/src/configureStore.ts#L137-L143

If someone can come up with a fix and file a PR, I'm open to taking it, but this is a very low priority concern to me atm.

@markerikson
Copy link
Collaborator

Closing due to lack of actionable feedback.

@stefan-ernst
Copy link

In case anyone comes here via google and is looking for a fix, including the es6-shim resolves the issue.

@felixpaq
Copy link

Even simpler fix, just set the devTools option to an empty object in the configureStore

export default configureStore({
  reducer: rootReducer,
  devTools: {}
});

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

5 participants