-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Redux chrome devtools crashing if bound action creator is not wrapped in another function #287
Comments
Thanks for the detailed report. I didn't use Could you please share a repo or a jsfiddle? So we could reproduce the error and maybe find a way to exclude the events while stringifing. |
Aha, that makes sense! Thanks for your hard work on maintaining this amazing library :) |
I don't seem to reproduce the issue with failing to access However, accessing the synthetic event will still not be possible as described in #275. As we are not allowed to access the object properties without throwing an Error by React (in dev mode only), we cannot detect if this object is an event. So, the only solution to prevent this, would be to check if it's an instance of import SyntheticEvent from 'react/lib/SyntheticEvent';
// ...
const store = createStore(rootReducer, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__({
serialize: {
replacer: (key, value) => {
if (value && value instanceof SyntheticEvent) return '[Event]';
return value;
}
}
})); Let me know if this approach works for you. |
Works like a charm! 👍 Sorry I left the fiddle with the onClick handler wrapped, so no error in that case, otherwise it reports the same error, but a bit masked, due to jsfiddle CORS issues. Thanks very much for the trick! |
I added
I'm using React v15.4.1 and if I check the |
Ok, just read up on this and the SyntheticEvent solution can no longer be used. Try this instead: |
Playing audio in react requires storing reference to audio reference in state. Modified above code snipped as
And redux-devtools is no longer crashes. |
I do a duck typing version of the SyntheticEvent check as follows. I guess I am digging into the internals a bit here, but I don't use dev tools in prod, so it only affects developer experience.
|
I came across a strange issue while dispatching actions that have no payload when I have the chrome devtools enabled.
The below code won't work with devtools-enabled in the store:
Store creation
Dummy duck
Dummy Connected component
This component won't be able to dispatch an action if I set
onClick={onToggleDummy}
. The console reports the below error when I click on the toggle button:However if I disable devtools in the store, everything works fine.
That problem can be worked around by wrapping the
onClick
handler in a extra function:onClick={() => onToggleDummy()}
Any ideas why this could be happening?
The text was updated successfully, but these errors were encountered: