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

Consider using error code strategy employed by react #3655

Closed
heygrady opened this issue Dec 12, 2019 · 4 comments
Closed

Consider using error code strategy employed by react #3655

heygrady opened this issue Dec 12, 2019 · 4 comments

Comments

@heygrady
Copy link

heygrady commented Dec 12, 2019

https://github.com/facebook/react/tree/master/scripts/error-codes

Right now, every production website that uses redux is shipping lengthy error messages that are better suited to development.

Example:

'Reducer "'+t+"" returned undefined when probed with a random type. Don't try to handle "+n.INIT+' or other actions in "redux/*" namespace. They are considered private. Instead, you must return the current state for any unknown actions, unless it is undefined, in which case you must return the initial state, regardless of the action type. The initial state may not be undefined, but can be null.'

My rough guestimate is that you could reduce the minified version of redux from 6660 characters to more like 4200 characters by replacing these long messages with terse, generated error codes like throw code(1). Seems worth it for potential savings of more than 35%.

@markerikson
Copy link
Contributor

Well, it's been 4.5 years and no one has complained yet :) But, I do see your point. It's not a priority for us to work on atm, but if you or someone else would like to put together the infrastructure, we can take a PR.

@andrewmcgivery
Copy link
Contributor

@markerikson I think this one can be closed now, right?

@markerikson
Copy link
Contributor

Yep!

FYI, I've got 4.1.0-alpha.0 ready to go - I just don't actually have publishing rights for the redux package atm because I've never had to publish it before :) Will put that up as soon as Tim adds me there.

@markerikson
Copy link
Contributor

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