Redux-devtools-extension: Non-string action types are reported `<UNDEFINED>`

Created on 21 Feb 2018  路  6Comments  路  Source: zalmoxisus/redux-devtools-extension

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).

Most helpful comment

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.

All 6 comments

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.

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? :)

I also have this problem.How to fix it?

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鈥檛 think there鈥檚 an advantage to using Symbols over strings for action types.

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()
      })
    })
);

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MrSkinny picture MrSkinny  路  4Comments

ThinkSalat picture ThinkSalat  路  3Comments

rahul-desai3 picture rahul-desai3  路  4Comments

dreszczyk picture dreszczyk  路  4Comments

machineghost picture machineghost  路  4Comments