zalmoxisus / remote-redux-devtools

Redux DevTools remotely.
http://zalmoxisus.github.io/monitoring/
MIT License
1.8k stars 138 forks source link

Unserializable keys in actions are simply thrown away #101

Open aeneasr opened 6 years ago

aeneasr commented 6 years ago

Suppose

store.dispatch({
  type: 'FOO',
  payload: new Error('ASDF')
})

With an appropriate reducer, something like (pseudocode):

const reducer = (state, action) => action.payload

Now we select the state somewhere and want to yield the error. This works as long the remote devtools middleware is disabled. As soon as it's enabled, action.payload is an empty object {} (the result you get when running JSON.parse(new Error('foo')). For now I switched to devtools-extensions to fix this.

dorian-marchal commented 5 years ago

redux-devtools-extension accepts a serialize option parameter to avoid that.

This is useful when the payload is an error (this can be the case with Flux Standard Actions).

Currently, errors actions are not very useful is devtools:

screenshot from 2019-02-07 14-16-25

With redux-devtools-extension, this is a bit better (but not ideal as the stack trace is missing):

screenshot from 2019-02-07 14-17-32