captbaritone / raven-for-redux

A Raven middleware for Redux
295 stars 25 forks source link

stateTransformer Usage. #6

Closed ChrisSargent closed 7 years ago

ChrisSargent commented 7 years ago

Hi - is there anyway to have this be called (or run) only if an error happens and only when the state is actually being submitted?

I ask because my state can get a little large and in testing I've occasionally hit the 'Request Entity too Large' error. So, I've set up a function that removes a couple of fields from my state before passing to Raven. But it is an iterative function and therefore potentially expensive so I'd prefer not to run it every time my state changes.

I guess I could use some shallow checking on the parts of the state I'm interested in, but I wonder if there's a better way?

captbaritone commented 7 years ago

Great idea. It looks like we could be using setDataCallback do to this. Upon looking at the code (https://github.com/getsentry/raven-js/blob/master/src/raven.js#L558-L565) I think we should be able to play nicely with any existing setDataCallback functions by utilizing the second (undocumented) argument passed to the callback.

Would you like to look into implementing this? If not, I'll probably have a little time to look into it this ~evening~ weekend.

ChrisSargent commented 7 years ago

Hey, I'm happy to have a look at it but it wouldn't be before the weekend either.

captbaritone commented 7 years ago

Cool. Leave a note here if/when you start working on it, and I'll do the same. That way we can be sure we don't double up.

captbaritone commented 7 years ago

I'm starting work on this.

captbaritone commented 7 years ago

Okay! I have a fix. @ChrisSargent would you like to give this pull request a review? https://github.com/captbaritone/raven-for-redux/pull/8