Skip to content
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

stateTransformer Mutating State #5

Closed
ChrisSargent opened this issue Apr 12, 2017 · 6 comments
Closed

stateTransformer Mutating State #5

ChrisSargent opened this issue Apr 12, 2017 · 6 comments

Comments

@ChrisSargent
Copy link

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
Copy link
Author

ChrisSargent commented Apr 12, 2017

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

@captbaritone
Copy link
Owner

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

@ChrisSargent
Copy link
Author

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
Copy link

@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
Copy link
Owner

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
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants