captbaritone / raven-for-redux

A Raven middleware for Redux
295 stars 25 forks source link

stateTransformer Mutating State #5

Closed ChrisSargent closed 7 years ago

ChrisSargent commented 7 years ago

Hi,

Maybe this is intentional behaviour and it should in fact be down do me to not mutate it, but, when I use the stateTransformer callback, any modifications I make to the state being passed to Raven are also present in the actual application state.

This is my cb function:

ChrisSargent commented 7 years ago

Ignore this, it was my fault, I was mutating my 'passed' state in a way that still mutated my old state!

captbaritone commented 7 years ago

Do you think we should improve the documentation to remind people not to mutate?

ChrisSargent commented 7 years ago

Probably a good idea actually. It was pretty obvious when I did it because it totally broke everything but might not be so easy if people would only make small changes.

akhayoon commented 7 years ago

@ChrisSargent I'm curious to what you do when the state is too large. Is there any way to figure that out before you send the error out with sentry? or do you just send specific reducers?

captbaritone commented 7 years ago

I don't think it's possible to accurately measure the size of the data before it is sent. For now, I think your best option is to use your knowledge of your application to omit portions of your state which you are large and are unlikely to be useful for diagnosing errors.

More info here: https://docs.sentry.io/learn/quotas/#attributes-limits

ChrisSargent commented 7 years ago

Hi @akhayoon, yes, I didn't measure the size, I just did as @captbaritone suggested above. I remove the parts of my state that I know are large and actually irrelevant. e.g. for a blog post, I send in the ID of the post but not the actual content.