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

Non-string action types are reported <UNDEFINED> #459

Closed
ajcrites opened this issue Feb 21, 2018 · 6 comments
Closed

Non-string action types are reported <UNDEFINED> #459

ajcrites opened this issue Feb 21, 2018 · 6 comments
Projects

Comments

@ajcrites
Copy link

You can use anything as an action type, but it seems like only strings are logged properly.

screen shot 2018-02-21 at 3 31 30 pm

For example if you have LOAD_USER = Symbol('load user'); and then dispatch({ type: LOAD_USER }), it will log the action as <UNDEFINED>.

The action type should be logged as String(action.type).

@zalmoxisus
Copy link
Owner

zalmoxisus commented Feb 21, 2018

Use serialize parameter for that:

const store = Redux.createStore(reducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
  serialize: true
}));

See API docs for more details.

I actually was trying to do the way you suggested in redux-devtools-instrument, but that was causing issues when recomputing actions.

@iamscottcox
Copy link

I'm having a similar issue, but some of my Symbol action types are being logged.

screenshot 2018-08-06 11 50 24

We have passed serialize as an option:
screenshot 2018-08-06 11 53 59

Any ideas on what might cause this? :)

@CoderKwong
Copy link

I also have this problem.How to fix it?

@ajcrites
Copy link
Author

IMO you should probably use strings for action types versus something like symbols. My understanding is that strings are serializable, but Symbols are not. The Redux docs specify this; I don’t think there’s an advantage to using Symbols over strings for action types.

@kymar
Copy link

kymar commented Oct 1, 2018

I recently had this problem and fixed it using the actionSanitizer key on object passed into the extension middleware to specifically convert the symbol to a string, seems like this is a little overkill but works for now ?

const store = createStore(
  rootReducer,
  window.__REDUX_DEVTOOLS_EXTENSION__ &&
    window.__REDUX_DEVTOOLS_EXTENSION__({
      actionSanitizer: action => ({
        ...action,
        type: action.type.toString()
      })
    })
);

@zalmoxisus
Copy link
Owner

It was a regression in jsan, it's downgraded now and fixed in 2.16, which will land o Chrome Store in a day.

@zalmoxisus zalmoxisus added this to Done in 2.16 Nov 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
2.16
  
Done
Development

No branches or pull requests

5 participants